Part Number Hot Search : 
LT11011 74435 MVCO1600 2S161 MCJ220CA 1N6275E3 KTR18 SMBJ550
Product Description
Full Text Search
 

To Download UPD70F3724 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  document no. u17714ej1v0ud00 (1st edition) date published october 2005 n cp(k) printed in japan preliminary user's manual v850es/jj2 32-bit single-chip microcontrollers hardware 2005 pd70f3720 pd70f3721 pd70f3722 pd70f3723 pd70f3724
preliminary user's manual u17714ej1v0ud 2 [memo]
preliminary user's manual u17714ej1v0ud 3 1 2 3 4 voltage application waveform at input pin waveform distortion due to input noise or a reflected wave may cause malfunction. if the input of the cmos device stays in the area between v il (max) and v ih (min) due to noise, etc., the device may malfunction. take care to prevent chattering noise from entering the device when the input level is fixed, and also in the transition period when the input level passes through the area between v il (max) and v ih (min). handling of unused input pins unconnected cmos device inputs can be cause of malfunction. if an input pin is unconnected, it is possible that an internal input level may be generated due to noise, etc., causing malfunction. cmos devices behave differently than bipolar or nmos devices. input levels of cmos devices must be fixed high or low by using pull-up or pull-down circuitry. each unused pin should be connected to v dd or gnd via a resistor if there is a possibility that it will be an output pin. all handling related to unused pins must be judged separately for each device and according to related specifications governing the device. precaution against esd a strong electric field, when exposed to a mos device, can cause destruction of the gate oxide and ultimately degrade the device operation. steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it when it has occurred. environmental control must be adequate. when it is dry, a humidifier should be used. it is recommended to avoid using insulators that easily build up static electricity. semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. all test and measurement tools including work benches and floors should be grounded. the operator should be grounded using a wrist strap. semiconductor devices must not be touched with bare hands. similar precautions need to be taken for pw boards with mounted semiconductor devices. status before initialization power-on does not necessarily define the initial status of a mos device. immediately after the power source is turned on, devices with reset functions have not yet been initialized. hence, power-on does not guarantee output pin levels, i/o settings or contents of registers. a device is not initialized until the reset signal is received. a reset operation must be executed immediately after power-on for devices with reset functions. power on/off sequence in the case of a device that uses different power supplies for the internal operation and external interface, as a rule, switch on the external power supply after switching on the internal power supply. when switching the power supply off, as a rule, switch off the external power supply and then the internal power supply. use of the reverse power on/off sequences may result in the application of an overvoltage to the internal elements of the device, causing malfunction and degradation of internal elements due to the passage of an abnormal current. the correct power on/off sequence must be judged separately for each device and according to related specifications governing the device. input of signal during power off state do not input signals or an i/o pull-up power supply while the device is not powered. the current injection that results from input of such a signal or i/o pull-up power supply may cause malfunction and the abnormal current that passes in the device at this time may cause degradation of internal elements. input of signals during the power off state must be judged separately for each device and according to related specifications governing the device. notes for cmos devices 5 6
preliminary user's manual u17714ej1v0ud 4 iecube and minicube are registered trademarks of nec electronics corporation in japan and germany. the information contained in this document is being issued in advance of the production cycle for the product. the parameters for the product may change before final production or nec electronics corporation, at its own discretion, may withdraw the product prior to its production. not all products and/or types are available in every country. please check with an nec electronics sales representative for availability and additional information. no part of this document may be copied or reproduced in any form or by any means without the prior written consent of nec electronics. nec electronics assumes no responsibility for any errors that may appear in this document. nec electronics does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of nec electronics products listed in this document or any other liability arising from the use of such products. no license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec electronics or others. descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. the incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. nec electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec electronics endeavors to enhance the quality, reliability and safety of nec electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. to minimize risks of damage to property or injury (including death) to persons arising from defects in nec electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. nec electronics products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to nec electronics products developed based on a customer-designated "quality assurance program" for a specific application. the recommended applications of an nec electronics products depend on its quality grade, as indicated below. customers must check the quality grade of each nec electronics product before using it in a particular application. "standard": computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "special": transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support). "specific": aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. the quality grade of nec electronics products is "standard" unless otherwise expressly specified in nec electronics data sheets or data books, etc. if customers wish to use nec electronics products in applications not intended by nec electronics, they must contact an nec electronics sales representative in advance to determine nec electronics' willingness to support a given application. (note) (1) "nec electronics" as used in this statement means nec electronics corporation and also includes its majority-owned subsidiaries. (2) "nec electronics products" means any product developed or manufactured by or for nec electronics (as defined above). ? ? ? ? ? ? ? m5d 02. 11-1
preliminary user's manual u17714ej1v0ud 5 regional information ? device availability ? ordering information ? product release schedule ? availability of related technical literature ? development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, ac supply voltages, and so forth) ? network requirements in addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. [global support] http://www.necel.com/en/support/support.html nec electronics america, inc. (u.s.) santa clara, california tel: 408-588-6000 800-366-9782 nec electronics hong kong ltd. hong kong tel: 2886-9318 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-558-3737 nec electronics shanghai ltd. shanghai, p.r. china tel: 021-5888-5400 nec electronics taiwan ltd. taipei, taiwan tel: 02-2719-2377 nec electronics singapore pte. ltd. novena square, singapore tel: 6253-8311 j05.6 n ec electronics (europe) gmbh duesseldorf, germany tel: 0211-65030 ? sucursal en espa?a madrid, spain tel: 091-504 27 87 vlizy-villacoublay, france tel: 01-30-67 58 00 ? succursale fran?aise ? filiale italiana milano, italy tel: 02-66 75 41 ? branch the netherlands eindhoven, the netherlands tel: 040-265 40 10 ? tyskland filial taeby, sweden tel: 08-63 87 200 ? united kingdom branch milton keynes, uk tel: 01908-691-133 some information contained in this document may vary from country to country. before using any nec electronics product in your application, piease contact the nec electronics office in your country to obtain a list of authorized representatives and distributors. they will verify:
preliminary user's manual u17714ej1v0ud 6 preface readers this manual is intended for users who wish to understand the functions of the v850es/jj2 and design application systems using the v850es/jj2. purpose this manual is intended to give users an understanding of the har dware functions of the v850es/jj2 shown in the organization below. organization this manual is divided into two parts: hardware (this manual) and architecture ( v850es architecture user's manual ). hardware architecture ? pin functions ? data types ? cpu function ? register set ? on-chip peripheral functions ? instruction format and instruction set ? flash memory programming ? interrupts and exceptions ? electrical specifications (target) ? pipeline operation how to read this manual it is assumed that the readers of this m anual have general knowledge in the fields of electrical engineering, logic circuits, and microcontrollers. to understand the overall func tions of the v850es/jj2 read this manual according to the contents . to find the details of a regi ster where the name is known use appendix a register index . to understand the details of an instruction function refer to the v850es architecture user's manual available separately. to know the electrical spec ifications of the v850es/jj2 see chapter 28 electrical specifications (target) . register format the name of the bit whose number is in angle brackets (<>) in the figure of the register format of each register is defi ned as a reserved word in the device file. the "yyy bit of the xxx register" is described as the "xxx.yyy bit" in this manual. note with caution that if "xxx.yyy" is descr ibed as is in a program, however, the compiler/assembler cannot recognize it correctly.
preliminary user's manual u17714ej1v0ud 7 conventions data significance: higher digits on the left and lower digits on the right active low representation: xxx (ove rscore over pin or signal name) memory map address: higher addresse s on the top and lower addresses on the bottom note : footnote for item marked with note in the text caution : information requiring particular attention remark : supplementary information numeric representation: binary ... xxxx or xxxxb decimal ... xxxx hexadecimal ... xxxxh prefix indicating power of 2 (address space, memory capacity): k (kilo): 2 10 = 1,024 m (mega): 2 20 = 1,024 2 g (giga): 2 30 = 1,024 3
preliminary user's manual u17714ej1v0ud 8 related documents the related documents indicated in this pub lication may include preliminary versions. however, preliminary versions are not marked as such. documents related to v850es/jj2 document name document no. v850es architecture user's manual u15943e v850es/jj2 hardware user's manual this manual documents related to development tools document name document no. operation u17293e c language u17291e assembly language u17292e ca850 ver. 3.00 c compiler package link directives u17294e pm+ ver. 6.00 project manager u17178e id850qb ver. 3.10 integrated debugger operation u17435e sm850 ver. 2.50 system simulator operation u16218e sm850 ver. 2.00 or later system si mulator external part user open interface specification u14873e operation u17246e sm+ system simulator user open interface u17247e basics u13430e installation u17419e technical u13431e rx850 ver. 3.20 or later real-time os task debugger u17420e basics u13773e installation u17421e technical u13772e rx850 pro ver. 3.20 real-time os task debugger u17422e az850 ver. 3.30 system performance analyzer u17423e pg-fp4 flash memory programmer u15260e
preliminary user's manual u17714ej1v0ud 9 contents chapter 1 introduction ...................................................................................................... ...........18 1.1 general ........................................................................................................................ .............18 1.2 features....................................................................................................................... .............21 1.3 application fields ............................................................................................................. ......22 1.4 ordering information ........................................................................................................... ...22 1.5 pin configuration (top view) ......................................... ........................................................23 1.6 function block configuration........................................ ........................................................25 1.6.1 internal bl ock di agram ......................................................................................................... ...... 25 1.6.2 internal units ................................................................................................................. ............. 26 chapter 2 pin funct ions.................................................................................................... ............29 2.1 list of pin functions.......................................................................................................... .....29 2.2 pin states ..................................................................................................................... ............40 2.3 pin i/o circuit types, i/o buffer power suppl ies and connection of unused pins.........41 2.4 cautions ....................................................................................................................... ............45 chapter 3 cpu function..................................................................................................... ............46 3.1 features....................................................................................................................... .............46 3.2 cpu register set............................................................................................................... ......47 3.2.1 program regi ster set ........................................................................................................... ....... 48 3.2.2 system regi ster set............................................................................................................ ........ 49 3.3 operation modes ................................................................................................................ .....55 3.3.1 specifying oper ation mode ...................................................................................................... .. 55 3.4 address space .................................................................................................................. ......56 3.4.1 cpu address space.............................................................................................................. ..... 56 3.4.2 wraparound of cpu addr ess spac e .......................................................................................... 57 3.4.3 memory map..................................................................................................................... ......... 58 3.4.4 areas .......................................................................................................................... ............... 60 3.4.5 recommended use of address s pace ....................................................................................... 67 3.4.6 peripheral i/o regist ers....................................................................................................... ....... 70 3.4.7 special r egister s .............................................................................................................. .......... 82 3.4.8 cauti ons ....................................................................................................................... ............. 86 chapter 4 port f unctions................................................................................................... .........90 4.1 features....................................................................................................................... .............90 4.2 basic port configuration ....................................................................................................... .90 4.3 port configuration........................................................... .................................................. ......91 4.3.1 port 0......................................................................................................................... ................ 96 4.3.2 port 1......................................................................................................................... ................ 99 4.3.3 port 3......................................................................................................................... .............. 100 4.3.4 port 4......................................................................................................................... .............. 106 4.3.5 port 5......................................................................................................................... .............. 108 4.3.6 port 6......................................................................................................................... .............. 112 4.3.7 port 7......................................................................................................................... .............. 116 4.3.8 port 8......................................................................................................................... .............. 118 4.3.9 port 9......................................................................................................................... .............. 120
preliminary user's manual u17714ej1v0ud 10 4.3.10 port cd ........................................................................................................................ ............128 4.3.11 port cm ........................................................................................................................ ...........129 4.3.12 port cs ........................................................................................................................ ............131 4.3.13 port ct ........................................................................................................................ ............133 4.3.14 port dh ........................................................................................................................ ............135 4.3.15 port dl ........................................................................................................................ ............137 4.4 block diagrams................................................................................................................. .... 140 4.5 port register settings when alternate function is used ................................................ 172 4.6 cautions ....................................................................................................................... ......... 181 4.6.1 cautions on se tting port pins .................................................................................................. .181 4.6.2 cautions on bit manipulation instru ction for port n r egister (pn) ...............................................184 4.6.3 cautions on on-ch ip debug pi ns...............................................................................................18 5 4.6.4 cautions on p05/in tp2/drst pin...........................................................................................185 4.6.5 cautions on p10, p11, and p53 pi ns when power is turned on ............................................... 185 4.6.6 hysteresis char acterist ics ..................................................................................................... ...185 chapter 5 bus control function ................................ .......................................................... 18 6 5.1 features....................................................................................................................... .......... 186 5.2 bus control pins............................................................................................................... .... 187 5.2.1 pin status when internal rom, internal ra m, or on-chip peripher al i/o is a ccessed...............187 5.2.2 pin status in eac h operation mode ...........................................................................................187 5.3 memory block function....................................................................................................... 188 5.4 external bus interface mode control function ......... ........................................................ 189 5.5 bus access ..................................................................................................................... ...... 190 5.5.1 number of clo cks for a ccess.................................................................................................... 190 5.5.2 bus size setti ng func tion ...................................................................................................... ....190 5.5.3 access by bus si ze ............................................................................................................. .....191 5.6 wait function .................................................................................................................. ...... 198 5.6.1 programmable wait function ....................................................................................................1 98 5.6.2 external wait func tion......................................................................................................... ......199 5.6.3 relationship between programmabl e wait and exte rnal wa it ................................................... 200 5.6.4 programmable address wait func tion .......................................................................................201 5.7 idle state insertion function ............................................................................................... 202 5.8 bus hold function.............................................................................................................. .. 203 5.8.1 functional outlin e............................................................................................................. ........203 5.8.2 bus hold pr ocedur e............................................................................................................. .....204 5.8.3 operation in power save mode ................................................................................................204 5.9 bus priority ................................................................................................................... ........ 205 5.10 bus timing ..................................................................................................................... ....... 206 chapter 6 clock generation function .................... .......................................................... 212 6.1 overview....................................................................................................................... ......... 212 6.2 configuration .................................................................................................................. ...... 213 6.3 registers ...................................................................................................................... ......... 215 6.4 operation...................................................................................................................... ......... 220 6.4.1 operation of each cl ock ........................................................................................................ ...220 6.4.2 clock output functi on .......................................................................................................... .....220 6.5 pll function................................................................................................................... ...... 221 6.5.1 overvi ew....................................................................................................................... ...........221
preliminary user's manual u17714ej1v0ud 11 6.5.2 regist ers ...................................................................................................................... ........... 221 6.5.3 usage .......................................................................................................................... ............ 224 chapter 7 16-bit timer/event counter p (tmp) .. ...............................................................225 7.1 overview....................................................................................................................... ..........225 7.2 functions ...................................................................................................................... .........225 7.3 configuration .................................................................................................................. .......226 7.4 registers ...................................................................................................................... ..........228 7.5 operation...................................................................................................................... ..........240 7.5.1 interval timer mode (tpnmd2 to tpnmd0 bi ts = 000)............................................................. 241 7.5.2 external event count mode (tpn md2 to tpnmd0 bits = 001)................................................. 251 7.5.3 external trigger pulse output mode (tpnmd2 to tpnmd0 bits = 010) ..................................... 259 7.5.4 one-shot pulse output mode (tpn md2 to tpnmd0 bits = 011) .............................................. 271 7.5.5 pwm output mode (tpnmd2 to tpnmd0 bi ts = 100).............................................................. 278 7.5.6 free-running timer mode (tpnmd2 to tpnmd0 bi ts = 101) .................................................... 287 7.5.7 pulse width measurement mode (tpn md2 to tpnmd0 bits = 110) ........................................ 304 7.5.8 timer output operati ons........................................................................................................ ... 310 7.6 selector function .......................................................................................................... ........311 7.7 cautions ....................................................................................................................... ..........313 chapter 8 16-bit timer/event counter q (tmq) ... .............................................................314 8.1 overview....................................................................................................................... ..........314 8.2 functions ...................................................................................................................... .........314 8.3 configuration .................................................................................................................. .......315 8.4 registers ...................................................................................................................... ..........317 8.5 operation...................................................................................................................... ..........333 8.5.1 interval timer mode (tq0md2 to tq0md0 bi ts = 000) ............................................................ 334 8.5.2 external event count mode (tq0 md2 to tq0md0 bits = 001) ................................................ 343 8.5.3 external trigger pulse output mode (tq0md2 to tq0md0 bits = 010) .................................... 352 8.5.4 one-shot pulse output mode (tq0 md2 to tq0md0 bits = 011) ............................................. 365 8.5.5 pwm output mode (tq0md2 to tq0md0 bi ts = 100) ............................................................. 374 8.5.6 free-running timer mode (tq0md2 to tq0md0 bi ts = 101) ................................................... 385 8.5.7 pulse width measurement mode (tq0 md2 to tq0md0 bits = 110)........................................ 405 8.5.8 timer output operati ons........................................................................................................ ... 411 8.6 cautions ....................................................................................................................... ..........412 chapter 9 16-bit interval timer m (tmm).......... ...................................................................413 9.1 overview....................................................................................................................... ..........413 9.2 configuration .................................................................................................................. .......414 9.3 register ....................................................................................................................... ...........415 9.4 operation...................................................................................................................... ..........416 9.4.1 interval ti mer m ode............................................................................................................ ...... 416 9.4.2 cauti ons ....................................................................................................................... ........... 420 chapter 10 watch timer functio ns .......................................................................................421 10.1 functions ...................................................................................................................... .........421 10.2 configuration .................................................................................................................. .......422 10.3 control registers .............................................................................................................. ....424 10.4 operation...................................................................................................................... ..........428
preliminary user's manual u17714ej1v0ud 12 10.4.1 operation as watch ti mer ....................................................................................................... ..428 10.4.2 operation as in terval timer.................................................................................................... ...429 10.4.3 cauti ons....................................................................................................................... ............430 chapter 11 functions of watchdog timer 2 .. ................................................................. 431 11.1 functions...................................................................................................................... ......... 431 11.2 configuration .................................................................................................................. ...... 432 11.3 registers ...................................................................................................................... ......... 433 11.4 operation...................................................................................................................... ......... 435 chapter 12 real-time output function (rto).. ................................................................. 436 12.1 function....................................................................................................................... .......... 436 12.2 configuration .................................................................................................................. ...... 437 12.3 registers ...................................................................................................................... ......... 439 12.4 operation...................................................................................................................... ......... 441 12.5 usage ......................................................................................................................... .......... 442 12.6 cautions ....................................................................................................................... ......... 442 chapter 13 a/d converter ................................................................................................... ...... 443 13.1 overview....................................................................................................................... ......... 443 13.2 functions...................................................................................................................... ......... 443 13.3 configuration .................................................................................................................. ...... 444 13.4 registers ...................................................................................................................... ......... 447 13.5 operation...................................................................................................................... ......... 458 13.5.1 basic oper ation ................................................................................................................ ........458 13.5.2 conversion operat ion ti ming .................................................................................................... 459 13.5.3 trigger mode ................................................................................................................... ........460 13.5.4 operati on m ode ................................................................................................................. ......462 13.5.5 power-fail co mpare mode ........................................................................................................ 466 13.6 cautions ....................................................................................................................... ......... 471 13.7 how to read a/d converter characteristics table... ........................................................ 475 chapter 14 d/a converter ................................................................................................... ...... 479 14.1 functions...................................................................................................................... ......... 479 14.2 configuration .................................................................................................................. ...... 479 14.3 registers ...................................................................................................................... ......... 480 14.4 operation...................................................................................................................... ......... 482 14.4.1 operation in normal mode ....................................................................................................... 482 14.4.2 operation in real-t ime output mode ..........................................................................................482 14.4.3 cauti ons....................................................................................................................... ............483 chapter 15 asynchronous serial interface a (uarta) ............................................. 484 15.1 mode switching of uarta and other serial interf aces ................................................... 484 15.1.1 csib4 and uarta0 m ode switch ing.......................................................................................484 15.1.2 uarta2 and i 2 c00 mode swit ching .........................................................................................485 15.1.3 uarta1 and i 2 c02 mode swit ching .........................................................................................486 15.2 features....................................................................................................................... .......... 487 15.3 configuration .................................................................................................................. ...... 488 15.4 registers ...................................................................................................................... ......... 490
preliminary user's manual u17714ej1v0ud 13 15.5 interrupt request signals......................... ............................................................................4 96 15.6 operation...................................................................................................................... ..........497 15.6.1 data fo rmat.................................................................................................................... .......... 497 15.6.2 sbf transmission/rec eption fo rmat.......................................................................................... 499 15.6.3 sbf trans missi on ............................................................................................................... ..... 501 15.6.4 sbf rec eptio n.................................................................................................................. ........ 502 15.6.5 uart trans missi on.............................................................................................................. .... 503 15.6.6 continuous transmi ssion proc edure ........................................................................................ 504 15.6.7 uart rec eptio n ................................................................................................................. ...... 506 15.6.8 reception errors ............................................................................................................... ....... 507 15.6.9 parity types and operat ions .................................................................................................... . 509 15.6.10 receive data noi se f ilter ...................................................................................................... .... 510 15.7 dedicated baud rate generator ................................. .........................................................511 15.8 cautions ....................................................................................................................... ..........519 chapter 16 3-wire variable-length serial i/o (csib) ....................................................520 16.1 mode switching of csib and other serial interfaces ........................................................520 16.1.1 csib4 and uarta0 m ode switch ing ...................................................................................... 520 16.1.2 csib0 and i 2 c01 mode swit ching ............................................................................................ 521 16.2 features....................................................................................................................... ...........521 16.3 configuration .................................................................................................................. .......522 16.4 registers ...................................................................................................................... ..........524 16.5 operation...................................................................................................................... ..........531 16.5.1 single transfer mode (master mode, transmission/rec eption m ode)........................................ 531 16.5.2 single transfer mode (master mode, recept ion m ode)............................................................. 532 16.5.3 continuous mode (master mode, transmission/rec eption m ode)............................................. 533 16.5.4 continuous mode (master m ode, recepti on mode) .................................................................. 534 16.5.5 continuous recepti on mode (e rror) .......................................................................................... 535 16.5.6 continuous mode (slave mode, transmission/rec eption m ode) ............................................... 536 16.5.7 continuous mode (slave m ode, recepti on mode) .................................................................... 537 16.5.8 clock ti ming ................................................................................................................... .......... 538 16.6 output pins .................................................................................................................... ........540 16.7 operation flow ................................................................................................................. .....541 16.8 baud rate generator ............................................................................................................ 547 16.8.1 baud rate generatio n ........................................................................................................... .... 548 16.9 cautions ....................................................................................................................... ..........549 chapter 17 i 2 c bus......................................................................................................................... ..550 17.1 mode switching of i 2 c bus and other serial interfaces ............ ........................................550 17.1.1 uarta2 and i 2 c00 mode swit ching ........................................................................................ 550 17.1.2 csib0 and i 2 c01 mode swit ching ............................................................................................ 551 17.1.3 uarta1 and i 2 c02 mode swit ching ........................................................................................ 552 17.2 features....................................................................................................................... ...........553 17.3 configuration .................................................................................................................. .......554 17.4 registers ...................................................................................................................... ..........558 17.5 i 2 c bus mode functions .......................................................................................................574 17.5.1 pin confi guratio n.............................................................................................................. ........ 574 17.6 i 2 c bus definitions and control methods ................. ..........................................................575 17.6.1 start c onditi on................................................................................................................ .......... 575
preliminary user's manual u17714ej1v0ud 14 17.6.2 addre sses...................................................................................................................... ..........576 17.6.3 transfer direction specific ation ............................................................................................... .577 17.6.4 ack ............................................................................................................................ .............578 17.6.5 stop condi tion ................................................................................................................. .........579 17.6.6 wait state..................................................................................................................... ............580 17.6.7 wait state cance llation me thod ................................................................................................5 82 17.7 i 2 c interrupt request signals (intiicn) ......................... ..................................................... 583 17.7.1 master devic e operat ion........................................................................................................ ...583 17.7.2 slave device operation (when receiving sl ave address data (addr ess matc h))........................586 17.7.3 slave device operation (when re ceiving extens ion c ode) ........................................................ 590 17.7.4 operation without communica tion ............................................................................................594 17.7.5 arbitration loss operation (operation as slave after arbi tration loss) .........................................594 17.7.6 operation when arbitration loss occurs ( no communication after arbitrati on loss) ...................596 17.8 interrupt request signal (intiicn) generation ti ming and wait control....................... 603 17.9 address match detection method ... ................................................................................... 605 17.10 error detection................................................................................................................ ...... 605 17.11 extension code................................................................................................................. .... 605 17.12 arbitration .................................................................................................................... ......... 606 17.13 wakeup function................................................................................................................ .. 607 17.14 communication reservation............................................................................................... 608 17.14.1 when communication reservation function is enabled (iicfn.iicr svn bit = 0) .......................608 17.14.2 when communication reservation function is disabled (iicfn.ii crsvn bit = 1).......................612 17.15 cautions ....................................................................................................................... ......... 613 17.16 communication operations ................................................................................................ 614 17.16.1 master oper ation 1............................................................................................................. ......614 17.16.2 master oper ation 2............................................................................................................. ......616 17.16.3 slave oper ation................................................................................................................ ........617 17.17 timing of data communication .......................................................................................... 620 chapter 18 dma function (dma controller) ..... .............................................................. 627 18.1 features....................................................................................................................... .......... 627 18.2 configuration .................................................................................................................. ...... 628 18.3 registers ...................................................................................................................... ......... 629 18.4 transfer targets ............................................................................................................... .... 636 18.5 transfer modes ................................................................................................................. .... 637 18.6 transfer types ................................................................................................................. ..... 637 18.7 dma channel priorities........................................................................................................ 6 38 18.8 time related to dma transfer ............................................................................................ 638 18.9 dma transfer start fact ors................................................................................................. 639 18.10 dma abort factors.............................................................................................................. . 640 18.11 end of dma transfer............................................................................................................ 640 18.12 operation timing ............................................................................................................... ... 640 18.13 cautions ....................................................................................................................... ......... 645 chapter 19 interrupt/exception processing fu nction............................................... 650 19.1 features....................................................................................................................... .......... 650 19.2 non-maskable interrupt s ..................................................................................................... 654 19.2.1 operat ion ...................................................................................................................... ...........656 19.2.2 restore ........................................................................................................................ ............657
preliminary user's manual u17714ej1v0ud 15 19.2.3 np fl ag........................................................................................................................ ............. 658 19.3 maskable interrupts ............................................................................................................ ..659 19.3.1 operat ion...................................................................................................................... ........... 659 19.3.2 restore........................................................................................................................ ............ 661 19.3.3 priorities of ma skable inte rrupts .............................................................................................. 662 19.3.4 interrupt control r egister ( xxicn) ............................................................................................. . 666 19.3.5 interrupt mask registers 0 to 4 (imr0 to imr4 )........................................................................ 668 19.3.6 in-service priority register (ispr)............................................................................................ . 670 19.3.7 id flag ........................................................................................................................ .............. 671 19.3.8 watchdog timer mode regi ster 2 (w dtm2) ............................................................................. 671 19.4 software exception ............................................................................................................. ..672 19.4.1 operat ion...................................................................................................................... ........... 672 19.4.2 restore........................................................................................................................ ............ 673 19.4.3 ep fl ag........................................................................................................................ ............. 674 19.5 exception trap ................................................................................................................. .....675 19.5.1 illegal opcode definit ion ...................................................................................................... ..... 675 19.5.2 debug tr ap..................................................................................................................... .......... 677 19.6 external interrupt request input pins (nmi and intp0 to intp8) ....................................679 19.6.1 noise elim inatio n .............................................................................................................. ....... 679 19.6.2 edge detec tion................................................................................................................. ........ 679 19.7 interrupt acknowledge time of cpu ...................................................................................685 19.8 periods in which interrupts are not acknowledged by cpu...........................................686 19.9 cautions ....................................................................................................................... ..........686 chapter 20 key interrupt function ......................... .............................................................687 20.1 function ....................................................................................................................... ..........687 20.2 register ....................................................................................................................... ...........688 20.3 cautions ....................................................................................................................... ..........688 chapter 21 standby function...................................... .......................................................... ...689 21.1 overview....................................................................................................................... ..........689 21.2 registers ...................................................................................................................... ..........691 21.3 halt mode...................................................................................................................... .......694 21.3.1 setting and operat ion st atus ................................................................................................... . 694 21.3.2 releasing ha lt m ode ............................................................................................................ 694 21.4 idle1 mode ..................................................................................................................... .......696 21.4.1 setting and operat ion st atus ................................................................................................... . 696 21.4.2 releasing id le1 m ode........................................................................................................... . 696 21.5 idle2 mode ..................................................................................................................... .......698 21.5.1 setting and operat ion st atus ................................................................................................... . 698 21.5.2 releasing id le2 m ode........................................................................................................... . 698 21.5.3 securing setup time when releasing id le2 m ode ................................................................... 700 21.6 stop mode ...................................................................................................................... ......701 21.6.1 setting and operat ion st atus ................................................................................................... . 701 21.6.2 releasing st op m ode............................................................................................................ 701 21.6.3 securing oscillation stabilization ti me when releasi ng stop mode ......................................... 704 21.7 subclock operation mode ....................................................................................................705 21.7.1 setting and operat ion st atus ................................................................................................... . 705 21.7.2 releasing subclock operation mode ........................................................................................ 705
preliminary user's manual u17714ej1v0ud 16 21.8 sub-idle mode .................................................................................................................. ... 707 21.8.1 setting and operat ion st atus ................................................................................................... .707 21.8.2 releasing sub- idle m ode .......................................................................................................7 07 chapter 22 reset functions ................................................................................................. .... 709 22.1 overview....................................................................................................................... ......... 709 22.2 registers to check reset source.................................. ..................................................... 710 22.3 operation...................................................................................................................... ......... 711 22.3.1 reset operation vi a reset pin ...............................................................................................711 22.3.2 reset operation by watchdog time r 2.......................................................................................713 22.3.3 reset operation by lo w-voltage det ector ..................................................................................715 22.3.4 operation after reset re lease .................................................................................................. .716 22.3.5 reset function operation flow.................................................................................................. .719 chapter 23 clock monitor ................................................................................................... ..... 720 23.1 functions...................................................................................................................... ......... 720 23.2 configuration .................................................................................................................. ...... 720 23.3 register ....................................................................................................................... .......... 721 23.4 operation...................................................................................................................... ......... 722 chapter 24 low-voltage detector (lvi) ............... .............................................................. 725 24.1 functions...................................................................................................................... ......... 725 24.2 configuration .................................................................................................................. ...... 725 24.3 registers ...................................................................................................................... ......... 726 24.4 operation...................................................................................................................... ......... 728 24.4.1 to use for inter nal rese t signal............................................................................................... ..728 24.4.2 to use for interr upt ........................................................................................................... .......729 24.5 ram retention voltage detection operation ............ ........................................................ 730 24.6 emulation function ............................................................................................................. . 731 chapter 25 regulator ........................................................................................................ ......... 732 25.1 overview....................................................................................................................... ......... 732 25.2 operation...................................................................................................................... ......... 733 chapter 26 flash memory .................................................................................................... ...... 734 26.1 features....................................................................................................................... .......... 734 26.2 memory configuration ......................................................................................................... 73 5 26.3 functional outline ............................................................................................................. ... 736 26.4 rewriting by dedicated flash programmer............... ........................................................ 738 26.4.1 programming env ironment .......................................................................................................7 38 26.4.2 communicati on m ode ............................................................................................................. .739 26.4.3 flash memory cont rol ........................................................................................................... ...745 26.4.4 selection of comm unication mode ...........................................................................................746 26.4.5 communication commands .....................................................................................................747 26.4.6 pin connec tion ................................................................................................................. ........748 26.5 rewriting by self programming ... ....................................................................................... 752 26.5.1 overvi ew....................................................................................................................... ...........752 26.5.2 featur es....................................................................................................................... ............753 26.5.3 standard self progr amming fl ow ..............................................................................................754
preliminary user's manual u17714ej1v0ud 17 26.5.4 flash f uncti ons ................................................................................................................ ........ 755 26.5.5 pin proc essi ng ................................................................................................................. ........ 755 26.5.6 internal res ources used ........................................................................................................ ... 756 chapter 27 on-chip debug function......................... .............................................................757 27.1 features....................................................................................................................... ...........757 27.2 connection circuit example ....................................... .........................................................758 27.3 interface signals.............................................................................................................. ......758 27.4 register ....................................................................................................................... ...........760 27.5 operation...................................................................................................................... ..........762 27.6 rom security function.........................................................................................................7 63 27.6.1 security id.................................................................................................................... ........... 763 27.6.2 setti ng ........................................................................................................................ ............. 764 27.7 cautions ....................................................................................................................... ..........765 chapter 28 electrical specifications (target) .... ..........................................................766 chapter 29 package drawing ...................................... ........................................................... ..800 appendix a register index .................................................................................................. ........801 appendix b instruction set list........................................................................................... ...813 b.1 conventions.................................................................................................................... .......813 b.2 instruction set (in alphabetical order) .................. .............................................................816
preliminary user's manual u17714ej1v0ud 18 chapter 1 introduction the v850es/jj2 is one of the products in the nec el ectronics v850 series of single-chip microcontrollers designed for low-power operation for real-time control applications. 1.1 general the v850es/jj2 is a 32-bit single-chip microcontrolle r that includes the v850es cpu core and peripheral functions such as rom/ram, a timer/counter, serial in terfaces, an a/d converter, and a d/a converter. in addition to high real-time response characteristics an d 1-clock-pitch basic instructions, the v850es/jj2 features multiply instructions, saturated operation instructions, bit manipulation instructions, etc., realized by a hardware multiplier, as optimum instructions for digital servo contro l applications. moreover, as a real-time control system, the v850es/jj2 enables an extremely high cost-performance for app lications that require low power consumption, such as home audio, printers, and digital home electronics. table 1-1 lists the products of the v850es/jj2. a model of the v850es/jj2 with reduced i/o, timer/counter , and serial interface functions, v850es/jg2, is also available. see table 1-2 v850es/jg2 product list .
chapter 1 introduction preliminary user's manual u17714ej1v0ud 19 table 1-1. v850es/jj2 product list part number pd70f3720 pd70f3721 pd70f3722 pd70f3723 pd70f3724 flash memory 128 kb 256 kb 384 kb 512 kb 640 kb internal memory ram 12 kb 24 kb 32 kb 40 kb 48 kb logical space 64 mb memory space external memory area 16 mb external bus interface address bus: 24 bits data bus: 8/16 bits multiplex bus mode/separate bus mode chip select signal: 4 general-purpose register 32 bits 32 registers main clock (oscillation frequency) ceramic/crystal/external clock (in pll mode: f x = 2.5 to 5 mhz (multiplied by 4) or f x = 2.5 mhz (multiplied by 8), in clock through mode: f x = 2.5 to 10 mhz) subclock (oscillation frequency) crystal/external clock (f xt = 32.768 khz) internal oscillator f r = 200 khz (typ.) minimum instruction executi on time 50 ns (main clock (f xx ) = 20 mhz) dsp function 32 32 = 64: 200 to 250 ns (at 20 mhz) 32 32 + 32 = 32: 300 ns (at 20 mhz) 16 16 = 32: 50 to 100 ns (at 20 mhz) 16 16 + 32 = 32: 150 ns (at 20 mhz) i/o port i/o: 128 (of which 5 v tolerant/n-ch open-drain output selectable: 60) timer 16-bit timer/event counter p: 9 channels 16-bit timer/event counter q: 1 channel 16-bit interval timer m: 1 channel watch timer: 1 channel watchdog timer : 1 channel real-time output port 6 bits 2 channels a/d converter 10-bit resolution 16 channels d/a converter 8-bit resolution 2 channels serial interface uart: 1 channel uart/csi: 1 channel uart/i 2 c bus: 2 channels csi: 4 channels csi/i 2 c bus: 1 channel dma controller 4 channels (transfer target: on-chip peripheral i/o, internal ram, external memory) interrupt source external: 10 (10) note , internal: 61 power save function halt/idle1/idle2/stop/subclock/sub-idle mode reset reset pin input, watchdog timer 2 (wdt2), clock monitor (clm), low-voltage detector (lvi) on-chip debug function provided (run/break) operating power supply voltage 2.85 to 3.6 v operating ambient temperature ? 40 to +85 c package 144-pin plastic lqfp (fine pitch) (20 20 mm) note the figure in parentheses indicates the number of ex ternal interrupts that can release the stop mode.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 20 table 1-2. v850es/jg2 product list part number pd70f3715 pd70f3716 pd70f3717 pd70f3718 pd70f3719 flash memory 128 kb 256 kb 384 kb 512 kb 640 kb internal memory ram 12 kb 24 kb 32 kb 40 kb 48 kb logical space 64 mb memory space external memory area 16 mb external bus interface address bus: 22 bits data bus: 8/16 bits multiplex bus mode/separate bus mode general-purpose register 32 bits 32 registers main clock (oscillation frequency) ceramic/crystal/external clock (in pll mode: f x = 2.5 to 5 mhz (multiplied by 4) or f x = 2.5 mhz (multiplied by 8), in clock through mode: f x = 2.5 to 10 mhz) subclock (oscillation frequency) crystal/external clock (f xt = 32.768 khz) internal oscillator f r = 200 khz (typ.) minimum instruction executi on time 50 ns (main clock (f xx ) = 20 mhz) dsp function 32 32 = 64: 200 to 250 ns (at 20 mhz) 32 32 + 32 = 32: 300 ns (at 20 mhz) 16 16 = 32: 50 to 100 ns (at 20 mhz) 16 16 + 32 = 32: 150 ns (at 20 mhz) i/o port i/o: 84 (of which 5 v tolerant/n-ch open drain-output selectable: 40) timer 16-bit timer/event counter p: 6 channels 16-bit timer/event counter q: 1 channel 16-bit interval timer m: 1 channel watch timer: 1 channel watchdog timer: 1 channel real-time output port 6 bits 1 channel a/d converter 10-bit resolution 12 channels d/a converter 8-bit resolution 2 channels serial interface uart/csi: 1 channel uart/i 2 c bus: 2 channels csi: 3 channels csi/i 2 c bus: 1 channel dma controller 4 channels (transfer target: on-chip peripheral i/o, internal ram, external memory) interrupt source external: 9 (9) note , internal: 48 power save function halt/idle1/idle2/stop/subclock/sub-idle mode reset reset pin input, watchdog timer 2 (wdt2), clock monitor (clm), low-voltage detector (lvi) on-chip debug function provided (run/break) operating power supply voltage 2.85 to 3.6 v operating ambient temperature ? 40 to +85 c 100-pin plastic lqfp (fine pitch) (14 14 mm) package 100-pin plastic qfp (14 20 mm) note the figure in parentheses indicates the number of ex ternal interrupts that can release the stop mode.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 21 1.2 features minimum instruction execution time: 50 ns (operating with main clock (f xx ) of 20 mhz) general-purpose registers: 32 bits 32 registers cpu features: signed multiplication (16 16 32): 1 to 2 clocks signed multiplication (32 32 64): 1 to 5 clocks saturated operations (overflow and underflow detection functions included) 32-bit shift instruction: 1 clock bit manipulation instructions load/store instructions with long/short format memory space: 64 mb of linear address space (for programs and data) external expansion: up to 16 mb (including 1 mb used as internal rom/ram) ? internal memory: ram: 12/24/32/40/48 kb (see table 1-1 ) flash memory: 128/256/384/512/640 kb (see table 1-1 ) ? external bus interface: separate bus/multiplexed bus output selectable 8-/16-bit data bus sizing function wait function ? programmable wait function ? external wait function idle state function bus hold function interrupts and exceptions: non-maskable interrupts: 2 sources maskable interrupts: 60 sources software exceptions: 32 sources exception trap: 2 sources i/o lines: i/o ports: 128 timer function: 16-bit interval timer m (tmm): 1 channel 16-bit timer/event counter p (tmp): 9 channels 16-bit timer/event counter q (tmq): 1 channel watch timer: 1 channel watchdog timer: 1 channel real-time output port: 6 bits 2 channels serial interface: asynchronous serial interface a (uarta) 3-wire variable-length serial interface b (csib) i 2 c bus interface (i 2 c) uarta/csib: 1 channel uarta/i 2 c: 2 channels csib/i 2 c: 1 channel csib: 4 channels uarta: 1 channel a/d converter: 10-bit resolution: 16 channels d/a converter: 8-bit resolution: 2 channels dma controller: 4 channels on-chip debug function: jtag interface clock generator: during main clock or subclock operation 7-level cpu clock (f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, f xt ) clock-through mode/pll mode selectable internal oscillation clock: 200 khz (typ.) power-save functions: halt/idle1/idle2/stop/subclock/sub-idle mode package: 144-pin plastic lqfp (fine pitch) (20 20)
chapter 1 introduction preliminary user's manual u17714ej1v0ud 22 1.3 application fields home audio, printers, digital home electronics, other consumer devices 1.4 ordering information part number package internal flash memory pd70f3720gj-uen-a pd70f3721gj-uen-a pd70f3722gj-uen-a pd70f3723gj-uen-a pd70f3724gj-uen-a 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 144-pin plastic lqfp (fine pitch) (20 20) 128 kb 256 kb 384 kb 512 kb 640 kb remark products with -a at the end of t he part number are lead-free products.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 23 1.5 pin configuration (top view) 144-pin plastic lqfp (fine pitch) (20 20) pd70f3720gj-uen-a pd70f3722gj-uen-a pd70f3724gj-uen-a pd70f3721gj-uen-a pd70f3723gj-uen-a pdl3/ad3 pdl2/ad2 pdl1/ad1 pdl0/ad0 bv dd bv ss pct7 pct6/astb pct5 pct4/rd pct3 pct2 pct1/wr1 pct0/wr0 pcs7 pcs6 pcs5 pcs4 pcm5 pcm4 pcm3/hldrq pcm2/hldak pcm1/clkout pcm0/wait pcs3/cs3 pcs2/cs2 pcs1/cs1 pcs0/cs0 pcd3 pcd2 pcd1 pcd0 p915/a15/intp6/tip50/top50 p914/a14/intp5/tip51/top51 p913/a13/intp4 p912/a12/sckb3 av ref0 av ss p10/ano0 p11/ano1 av ref1 p00/tip61/top61 p01/tip60/top60 flmd0 note 1 v dd regc note 2 v ss x1 x2 reset xt1 xt2 p02/nmi p03/intp0/adtrg p04/intp1 p05/intp2/drst p06/intp3 p40/sib0/sda01 p41/sob0/scl01 p42/sckb0 p30/txda0/sob4 p31/rxda0/intp7/sib4 p32/ascka0/sckb4/tip00/top00 p33/tip01/top01 p34/tip10/top10 p35/tip11/top11 p36 p37 ev ss ev dd p38/txda2/sda00 p39/rxda2/scl00 p50/tiq01/kr0/toq01/rtp00 p51/tiq02/kr1/toq02/rtp01 p52/tiq03/kr2/toq03/rtp02/ddi p53/sib2/kr3/tiq00/toq00/rtp03/ddo p54/sob2/kr4/rtp04/dck p55/sckb2/kr5/rtp05/dms p60/rtp10 p61/rtp11 p62/rtp12 p63/rtp13 p64/rtp14 p65/rtp15 p66/sib5 p67/sob5 p68/sckb5 p69/tip70/top70 p610/tip71 p611/top71 p612/tip80/top80 p613/tip81/top81 p614 p615 p80/rxda3/intp8 p81/txda3 p90/a0/kr6/txda1/sda02 p91/a1/kr7/rxda1/scl02 p92/a2/tip41/top41 p93/a3/tip40/top40 p94/a4/tip31/top31 p95/a5/tip30/top30 p96/a6/tip21/top21 p97/a7/sib1/tip20/top20 p98/a8/sob1 p99/a9/sckb1 p910/a10/sib3 p911a11/sob3 p70/ani0 p71/ani1 p72/ani2 p73/ani3 p74/ani4 p75/ani5 p76/ani6 p77/ani7 p78/ani8 p79/ani9 p710/ani10 p711/ani11 p712/ani12 p713/ani13 p714/ani14 p715/ani15 pdh7/a23 pdh6/a22 pdh5/a21 pdh4/a20 pdh3/a19 pdh2/a18 pdh1/a17 pdh0/a16 pdl15/ad15 pdl14/ad14 pdl13/ad13 pdl12/ad12 pdl11/ad11 pdl10/ad10 pdl9/ad9 pdl8/ad8 pdl7/ad7 pdl6/ad6 pdl5/ad5/flmd1 pdl4/ad4 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 notes 1. connect these pins to v ss in the normal mode. 2. connect the regc pin to v ss via a 4.7 f (preliminary value) capacitor.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 24 pin names a0 to a23: ad0 to ad15: adtrg: ani0 to ani15: ano0, ano1: ascka0: astb: av ref0 , av ref1 : av ss : bv dd : bv ss : clkout: cs0 to cs3: dck: ddi: ddo: dms: drst: ev dd : ev ss : flmd0, flmd1: hldak: hldrq: intp0 to intp8: kr0 to kr7: nmi: p00 to p06: p10, p11: p30 to p39: p40 to p42: p50 to p55: p60 to p615: p70 to p715: p80, p81: p90 to p915: pcd0 to pcd3: pcm0 to pcm5: pcs0 to pcs7: pct0 to pct7: pdh0 to pdh7: address bus address/data bus a/d trigger input analog input analog output asynchronous serial clock address strobe analog reference voltage analog v ss power supply for bus interface ground for bus interface clock output chip select debug clock debug data input debug data output debug mode select debug reset power supply for port ground for port flash programming mode hold acknowledge hold request external interrupt input key return non-maskable interrupt request port 0 port 1 port 3 port 4 port 5 port 6 port 7 port 8 port 9 port cd port cm port cs port ct port dh pdl0 to pdl15: rd: regc: reset: rtp00 to rtp05, rtp10 to rtp15: rxda0 to rxda3: sckb0 to sckb5: scl00 to scl02: sda00 to sda02: sib0 to sib5: sob0 to sob5: tip00, tip01, tip10, tip11, tip20, tip21, tip30, tip31, tip40, tip41, tip50, tip51, tip60, tip61, tip70, tip71, tip80, tip81, tiq00 to tiq03: top00, top01, top10, top11, top20, top21, top30, top31, top40, top41, top50, top51, top60, top61, top70, top71, top80, top81, toq00 to toq03: txda0 to txda3: v dd : v ss : wait: wr0: wr1: x1, x2: xt1, xt2: port dl read strobe regulator control reset real-time output port receive data serial clock serial clock serial data serial input serial output timer input timer output transmit data power supply ground wait lower byte write strobe upper byte write strobe crystal for main clock crystal for subclock
chapter 1 introduction preliminary user's manual u17714ej1v0ud 25 1.6 function block configuration 1.6.1 internal block diagram nmi toq00 to toq03 tiq00 to tiq03 rtp00 to rtp05, rtp10 to rtp15 sob0/sda01 sib0/scl01 sckb0 intp0 to intp8 intc top00 to top80, top01 to top81 tip00 to tip80, tip01 to tip81 kr0 to kr7 rto csib1 to csib3, csib5 dmac note 1 note 2 ram rom pc alu cpu hldrq hldak astb rd wait wr0, wr1 a0 to a23 ad0 to ad15 flmd0 flmd1 cg pll cs0 to cs3 pcs0 to pcs7 pcm0 to pcm5 pct0 to pct7 pdh0 to pdh7 pdl0 to pdl15 pcd0 to pcd3 p90 to p915 p80, p81 p70 to p715 p60 to p615 p50 to p55 p40 to p42 p30 to p39 p10, p11 p00 to p06 av ref1 ano0, ano1 ani0 to ani15 av ss av ref0 adtrg clkout xt1 xt2 x1 x2 reset v dd v ss regc bv dd bv ss ev dd ev ss bcu sob1 to sob3, sob5 sib1 to sib3, sib5 sckb1 to sckb3, sckb5 txda0/sob4 rxda0/sib4 ascka0/sckb4 txda2/sda00 rxda2/scl00 csib0 i 2 c01 uarta0 csib4 uarta2 i 2 c00 txda3 rxda3 uarta3 txda1/sda02 rxda1/scl02 uarta1 i 2 c02 drst dms ddi dck ddo 16-bit timer/ counter q: 1 ch 16-bit timer/ counter p: 9 ch 16-bit interval timer m: 1 ch general-purpose registers 32 bits 32 multiplier 16 16 32 system registers 32-bit barrel shifter instruction queue watchdog timer 2 watch timer key return function regulator on-chip debug function a/d converter d/a converter ports internal oscillator clm lvi notes 1. 128/256/384/512/640 kb (flash memory) (see table 1-1 ) 2. 12/24/32/40/48 kb (see table 1-1 )
chapter 1 introduction preliminary user's manual u17714ej1v0ud 26 1.6.2 internal units (1) cpu the cpu uses five-stage pipeline control to enable single -clock execution of addres s calculations, arithmetic logic operations, data transfers, and almost all other instruction processing. other dedicated on-chip hardware, such as a multiplier (16 bits 16 bits 32 bits) and a barrel shifter (32 bits) contribute to faster complex processing. (2) bus control unit (bcu) the bcu starts a required external bus cycle based on the physical address obtai ned by the cpu. when an instruction is fetched from external memory space a nd the cpu does not send a bus cycle start request, the bcu generates a prefetch address and prefetches the instruction code. the pref etched instruction code is stored in an instruction queue. (3) rom this is a 640/512/384/25 6/128 kb flash memory m apped to addresse s 0000000h to 00 9ffffh/0000000h to 007ffffh/0000000h to 005ffffh/000000 0h to 003ffffh/0000000h to 001 ffffh. it can be accessed from the cpu in one clock during instruction fetch. (4) ram this is a 12/24/32/40/48 kb ram mapped to addresses 3ff3000h to 3ffefffh/3ff5000h to 3ffefffh/3ff7000h to 3ffefffh/3ff 9000h to 3ffefffh/3ffc000h to 3 ffefffh. it can be accessed from the cpu in one clock during data access. (5) interrupt controller (intc) this controller handles hardware interrupt requests (nmi, intp0 to intp8) from on-chip peripheral hardware and external hardware. eight levels of interrupt priorities can be specified for these interrupt requests, and multiple servicing control can be performed. (6) clock generator (cg) a main clock oscillator that generates the main clock oscillation frequency (f x ) and a subclock oscillator that generates the subclock oscillation frequency (f xt ) are available. as the main clock frequency (f xx ), f x is used as is in the clock-through mode and is multiplied by four or eight in the pll mode. the cpu clock frequency (f cpu ) can be selected from seven types: f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, and f xt . (7) internal oscillator an internal oscillator is provided on chip. the oscill ation frequency is 200 khz (typ.). an internal oscillator supplies the clock for watchdog timer 2 and timer m. (8) timer/counter nine-channel 16-bit timer/event counter p (tmp), one- channel 16-bit timer/event counter q (tmq), and one- channel 16-bit interval timer m (tmm) are provided on chip. (9) watch timer this timer counts the reference time period (0.5 s) for counting the clock (the 32.768 khz from the subclock or the 32.768 khz f brg from prescaler 3). the watch timer can also be used as an interval timer for the main clock.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 27 (10) watchdog timer 2 a watchdog timer is provided on chip to detect inadv ertent program loops, system abnormalities, etc. the internal oscillation clock, the main clock, or t he subclock can be selected as the source clock. watchdog timer 2 generates a non-maskable interrupt request signal (intwdt2) or a system reset signal (wdt2res) after an overflow occurs. (11) serial interface the v850es/jj2 includes three kinds of serial interfaces: asynchronous serial interface a (uarta), 3-wire variable-length serial interface b (csib), and an i 2 c bus interface (i 2 c). in the case of uarta, data is transferred via the txda0 to txda3 pins and rxda0 to rxda3 pins. in the case of csib, data is transferred via the sob0 to sob5 pins, sib0 to sib5 pins, and sckb0 to sckb5 pins. in the case of i 2 c, data is transferred via the sda00 to sda02 and scl00 to scl02 pins. (12) a/d converter this 10-bit a/d converter includes 16 analog input pins. conversion is performed using the successive approximation method. (13) d/a converter a two-channel, 8-bit-resolution d/a converter that uses the r-2r ladder method is provided on chip. (14) dma controller a 4-channel dma controller is provided on chip. this controller transfers data between the internal ram and on-chip peripheral i/o devices in resp onse to interrupt requests sent by on-chip peripheral i/o. (15) key interrupt function a key interrupt request signal (intkr) can be generated by inputting a falling edge to key input pins (8 channels). (16) real-time output function the real-time output function transfe rs preset 6-bit data to output la tches upon the occurrence of a timer compare register match signal. (17) on-chip debug function an on-chip debug function that uses the jtag (joint test action group) communication specifications is provided. switching between the normal port function and on-chip debugging function is done with the control pin input level and the ocdm register.
chapter 1 introduction preliminary user's manual u17714ej1v0ud 28 (18) ports the general-purpose port functions and cont rol pin functions are listed below. port i/o alternate function p0 7-bit i/o timer i/o, nmi, external interrupt, a/d converter trigger, debug reset p1 2-bit i/o d/a converter analog output p3 10-bit i/o external interrupt, serial interface, timer i/o p4 3-bit i/o serial interface p5 6-bit i/o timer i/o, real-time output, key in terrupt input, serial interface, debug i/o p6 16-bit i/o real-time output, serial interface, timer i/o p7 16-bit i/o a/d converter analog input p8 2-bit i/o serial interface, external interrupt p9 16-bit i/o external address bus, serial interface, key interrupt input, timer i/o, external interrupt pcd 4-bit i/o ? pcm 6-bit i/o external control signal pcs 8-bit i/o chip select output pct 8-bit i/o external control signal pdh 8-bit i/o external address bus pdl 16-bit i/o external address/data bus
preliminary user's manual u17714ej1v0ud 29 chapter 2 pin functions 2.1 list of pin functions the names and functions of the pins of the v850es/jj2 are described below. there are four types of pin i/o buffer power supplies: av ref0 , av ref1 , bv dd , and ev dd . the relationship between these power supplies and the pins is described below. table 2-1. pin i/o buffer power supplies power supply corresponding pins av ref0 port 7 av ref1 port 1 bv dd ports cd, cm, cs, ct, dh, dl ev dd reset, ports 0, 3 to 6, 8, 9
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 30 (1) port pins (1/4) pin name pin no. i/o function alternate function p00 6 tip61/top61 p01 7 tip60/top60 p02 17 nmi p03 18 intp0/adtrg p04 19 intp1 p05 note 20 intp2/drst p06 21 i/o port 0 7-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. intp3 p10 3 ano0 p11 4 i/o port 1 2-bit i/o port input/output can be specified in 1-bit units. ano1 p30 25 txda0/sob4 p31 26 rxda0/intp7/sib4 p32 27 ascka0/sckb4/tip00/top00 p33 28 tip01/top01 p34 29 tip10/top10 p35 30 tip11/top11 p36 31 ? p37 32 ? p38 35 txda2/sda00 p39 36 i/o port 3 10-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. rxda2/scl00 p40 22 sib0/sda01 p41 23 sob0/scl01 p42 24 i/o port 4 3-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. sckb0 p50 37 tiq01/kr0/toq01/rtp00 p51 38 tiq02/kr1/toq02/rtp01 p52 39 tiq03/kr2/toq03/rtp02/ddi p53 40 sib2/kr3/tiq00/toq00/rtp03/ ddo p54 41 sob2/kr4/rtp04/dck p55 42 i/o port 5 6-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. sckb2/kr5/rtp05/dms note incorporates a pull-down resistor. it can be disconnected by clearing the ocdm.ocdm0 bit.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 31 (2/4) pin name pin no. i/o function alternate function p60 43 rtp10 p61 44 rtp11 p62 45 rtp12 p63 46 rtp13 p64 47 rtp14 p65 48 rtp15 p66 49 sib5 p67 50 sob5 p68 51 sckb5 p69 52 tip70/top70 p610 53 tip71 p611 54 top71 p612 55 tip80/top80 p613 56 tip81/top81 p614 57 ? p615 58 i/o port 6 16-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. ? p70 144 ani0 p71 143 ani1 p72 142 ani2 p73 141 ani3 p74 140 ani4 p75 139 ani5 p76 138 ani6 p77 137 ani7 p78 136 ani8 p79 135 ani9 p710 134 ani10 p711 133 ani11 p712 132 ani12 p713 131 ani13 p714 130 ani14 p715 129 i/o port 7 16-bit i/o port input/output can be specified in 1-bit units. ani15 p80 59 rxda3/intp8 p81 60 i/o port 8 2-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. txda3
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 32 (3/4) pin name pin no. i/o function alternate function p90 61 a0/kr6/txda1/sda02 p91 62 a1/kr7/rxda1/scl02 p92 63 a2/tip41/top41 p93 64 a3/tip40/top40 p94 65 a4/tip31/top31 p95 66 a5/tip30/top30 p96 67 a6/tip21/top21 p97 68 a7/sib1/tip20/top20 p98 69 a8/sob1 p99 70 a9/sckb1 p910 71 a10/sib3 p911 72 a11/sob3 p912 73 a12/sckb3 p913 74 a13/intp4 p914 75 a14/intp5/tip51/top51 p915 76 i/o port 9 16-bit i/o port input/output can be specified in 1-bit units. n-ch open-drain output can be specified in 1-bit units. 5 v tolerant. a15/intp6/tip50/top50 pcd0 77 ? pcd1 78 ? pcd2 79 ? pcd3 80 i/o port cd 4-bit i/o port input/output can be specified in 1-bit units. ? pcm0 85 wait pcm1 86 clkout pcm2 87 hldak pcm3 88 hldrq pcm4 89 ? pcm5 90 i/o port cm 6-bit i/o port input/output can be specified in 1-bit units. ? pcs0 81 cs0 pcs1 82 cs1 pcs2 83 cs2 pcs3 84 cs3 pcs4 91 ? pcs5 92 ? pcs6 93 ? pcs7 94 i/o port cs 8-bit i/o port input/output can be specified in 1-bit units. ?
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 33 (4/4) pin name pin no. i/o function alternate function pct0 95 wr0 pct1 96 wr1 pct2 97 ? pct3 98 ? pct4 99 rd pct5 100 ? pct6 101 astb pct7 102 i/o port ct 8-bit i/o port input/output can be specified in 1-bit units. ? pdh0 121 a16 pdh1 122 a17 pdh2 123 a18 pdh3 124 a19 pdh4 125 a20 pdh5 126 a21 pdh6 127 a22 pdh7 128 i/o port dh 8-bit i/o port input/output can be specified in 1-bit units. a23 pdl0 105 ad0 pdl1 106 ad1 pdl2 107 ad2 pdl3 108 ad3 pdl4 109 ad4 pdl5 110 ad5/flmd1 pdl6 111 ad6 pdl7 112 ad7 pdl8 113 ad8 pdl9 114 ad9 pdl10 115 ad10 pdl11 116 ad11 pdl12 117 ad12 pdl13 118 ad13 pdl14 119 ad14 pdl15 120 i/o port dl 16-bit i/o port input/output can be specified in 1-bit units. ad15
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 34 (2) non-port pins (1/6) pin name pin no. i/o function alternate function a0 61 p90/kr6/txda1/sda02 a1 62 p91/kr7/rxda1/scl02 a2 63 p92/tip41/top41 a3 64 p93/tip40/top40 a4 65 p94/tip31/top31 a5 66 p95/tip30/top30 a6 67 p96/tip21/top21 a7 68 p97/sib1/tip20/top20 a8 69 p98/sob1 a9 70 p99/sckb1 a10 71 p910/sib3 a11 72 p911/sob3 a12 73 p912/sckb3 a13 74 p913/intp4 a14 75 p914/intp5/tip51/top51 a15 76 output address bus for external memory (when using separate bus) n-ch open-drain output selectable 5 v tolerant. p915/intp6/tip50/top50 a16 121 pdh0 a17 122 pdh1 a18 123 pdh2 a19 124 pdh3 a20 125 pdh4 a21 126 pdh5 a22 127 pdh6 a23 128 output address bus for external memory pdh7 ad0 105 pdl0 ad1 106 pdl1 ad2 107 pdl2 ad3 108 pdl3 ad4 109 pdl4 ad5 110 pdl5/flmd1 ad6 111 pdl6 ad7 112 pdl7 ad8 113 pdl8 ad9 114 pdl9 ad10 115 pdl10 ad11 116 pdl11 ad12 117 pdl12 ad13 118 pdl13 ad14 119 pdl14 ad15 120 i/o address bus/data bus for external memory pdl15 adtrg 18 input a/d converter external trigger input, 5 v tolerant p03/intp0
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 35 (2/6) pin name pin no. i/o function alternate function ani0 144 p70 ani1 143 p71 ani2 142 p72 ani3 141 p73 ani4 140 p74 ani5 139 p75 ani6 138 p76 ani7 137 p77 ani8 136 p78 ani9 135 p79 ani10 134 p710 ani11 133 p711 ani12 132 p712 ani13 131 p713 ani14 130 p714 ani15 129 input analog voltage input for a/d converter p715 ano0 3 p10 ano1 4 output analog voltage output for d/a converter p11 ascka0 27 input uarta0 baud rate clock input, 5 v tolerant p32/sckb4/tip00/top00 astb 101 output address strobe signal output for external memory pct6 av ref0 1 reference voltage input for a/d converter, positive power supply for alternate-function port 7 ? av ref1 5 ? reference voltage input for d/a converter, positive power supply for alternate-function port 1 ? av ss 2 ? ground potential for a/d and d/a converters (same potential as v ss ) ? bv dd 104 ? positive power supply for bus interface and alternate-function ports ? bv ss 103 ? ground potential for bus interface and alternate-function ports ? clkout 86 output internal system clock output pcm1 cs0 81 pcs0 cs1 82 pcs1 cs2 83 pcs2 cs3 84 output chip select output pcs3 dck 41 input debug clock input, 5 v tolerant p54/sob2/kr4/rtp04 ddi 39 input debug data input, 5 v tolerant p52/tiq03/kr2/toq03/rtp02 ddo note 40 output debug data output n-ch open-drain output selectable, 5 v tolerant p53/sib2/kr3/tiq00/toq00/ rtp03 dms 42 input debug mode select input, 5 v tolerant p55/sckb2/kr5/rtp05 drst 20 input debug reset input, 5 v tolerant p05/intp2 ev dd 34 ? positive power supply for external (same potential as v dd ) ? ev ss 33 ? ground potential for external (same potential as v ss ) ? flmd0 8 ? flmd1 110 input flash memory programming mode setting pin pdl5/ad5 note in the on-chip debug mode, high-level output is forcibly set.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 36 (3/6) pin name pin no. i/o function alternate function hldak 87 output bus hold acknowledge output pcm2 hldrq 88 input bus hold request input pcm3 intp0 18 p03/adtrg intp1 19 p04 intp2 20 p05/drst intp3 21 p06 intp4 74 p913/a13 intp5 75 p914/a14/tip51/top51 intp6 76 p915/a15/tip50/top50 intp7 26 p31/rxda0/sib4 intp8 59 input external interrupt request input (maskable, analog noise elimination). analog noise elimination/digital noise elimination selectable for the intp3 pin. 5 v tolerant p80/rxda3 kr0 note 1 37 p50/tiq01/toq01/rtp00 kr1 note 1 38 p51/tiq02/toq02/rtp01 kr2 note 1 39 p52/tiq03/toq03/rtp02/ddi kr3 note 1 40 p53/sib2/tiq00/toq00/rtp03/ddo kr4 note 1 41 p54/sob2/rtp04/dck kr5 note 1 42 p55/sckb2/rtp05/dms kr6 note 1 61 p90/a0/txda1/sda02 kr7 note 1 62 input key interrupt input (on-chip analog noise eliminator) 5 v tolerant p91/a1/rxda1/scl02 nmi note 2 17 input external interrupt input (non-maskable, analog noise elimination) 5 v tolerant p02 rd 99 output read strobe signal output for external memory pct4 regc 10 ? connection of regulator output stabilization capacitance (4.7 f (preliminary value)) ? reset 14 input system reset input ? rtp00 37 p50/tiq01/kr0/toq01 rtp01 38 p51/tiq02/kr1/toq02 rtp02 39 p52/tiq03/kr2/toq03/ddi rtp03 40 p53/sib2/kr3/tiq00/toq00/ddo rtp04 41 p54/sob2/kr4/dck rtp05 42 p55/sckb2/kr5/dms rtp10 43 p60 rtp11 44 p61 rtp12 45 p62 rtp13 46 p63 rtp14 47 p64 rtp15 48 output real-time output port n-ch open-drain output selectable 5 v tolerant p65 notes 1. pull this pin up externally. 2. the nmi pin alternately functions as the p02 pin. in functions as the p02 pin after reset. to enable the nmi pin, set the pmc0.pmc02 bit to 1. the initial setting of the nmi pin is "no edge detected". select the nmi pin valid edge using intf0 and intr0 registers.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 37 (4/6) pin name pin no. i/o function alternate function rxda0 26 p31/intp7/sib4 rxda1 62 p91/a1/kr7/scl02 rxda2 36 p39/scl00 rxda3 59 input serial receive data input (uarta0 to uarta3) 5 v tolerant p80/intp8 sckb0 24 p42 sckb1 70 p99/a9 sckb2 42 p55/kr5/rtp05/dms sckb3 73 p912/a12 sckb4 27 p32/ascka0/tip00/top00 sckb5 51 i/o serial clock i/o (csib0 to csib5) n-ch open-drain output selectable 5 v tolerant p68 scl00 36 p39/rxda2 scl01 23 p41/sob0 scl02 62 i/o serial clock i/o (i 2 c00 to i 2 c02) n-ch open-drain output selectable 5 v tolerant p91/a1/kr7/rxda1 sda00 35 p38/txda2 sda01 22 p40/sib0 sda02 61 i/o serial transmit/receive data i/o (i 2 c00 to i 2 c02) n-ch open-drain output selectable 5 v tolerant p90/a0/kr6/txda1 sib0 22 p40/sda01 sib1 68 p97/a7/tip20/top20 sib2 40 p53/kr3/tiq00/toq00/rtp03/ ddo sib3 71 p910/a10 sib4 26 p31/rxda0/intp7 sib5 49 input serial receive data input (csib0 to csib5) 5 v tolerant p66 sob0 23 p41/scl01 sob1 69 p98/a8 sob2 41 p54/kr4/rtp04/dck sob3 72 p911/a11 sob4 25 p30/txda0 sob5 50 output serial transmit data output (csib0 to csib5) n-ch open-drain output selectable 5 v tolerant p67 tip00 27 external event count input/capture trigger input/external trigger input (tmp0), 5 v tolerant p32/ascka0/sckb4/top00 tip01 28 capture trigger input (tmp0), 5 v tolerant p33/top01 tip10 29 external event count input/capture trigger input/external trigger input (tmp1), 5 v tolerant p34/top10 tip11 30 capture trigger input (tmp1), 5 v tolerant p35/top11 tip20 68 external event count input/capture trigger input/external trigger input (tmp2), 5 v tolerant p97/a7/sib1/top20 tip21 67 capture trigger input (tmp2), 5 v tolerant p96/a6/top21 tip30 66 external event count input/capture trigger input/external trigger input (tmp3), 5 v tolerant p95/a5/top30 tip31 65 capture trigger input (tmp3), 5 v tolerant p94/a4/top31 tip40 64 input external event count input/capture trigger input/external trigger input (tmp4), 5 v tolerant p93/a3/top40
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 38 (5/6) pin name pin no. i/o function alternate function tip41 63 capture trigger input (tmp4), 5 v tolerant p92/a2/top41 tip50 76 external event count input/capture trigger input/external trigger input (tmp5), 5 v tolerant p915/a15/intp6/top50 tip51 75 capture trigger input (tmp5), 5 v tolerant p914/a14/intp5/top51 tip60 7 external event count input/capture trigger input/external trigger input (tmp6), 5 v tolerant p01/top60 tip61 6 capture trigger input (tmp6), 5 v tolerant p00/top61 tip70 52 external event count input/capture trigger input/external trigger input (tmp7), 5 v tolerant p69/top70 tip71 53 capture trigger input (tmp7), 5 v tolerant p610 tip80 55 external event count input/capture trigger input/external trigger input (tmp8), 5 v tolerant p612/top80 tip81 56 capture trigger input (tmp8), 5 v tolerant p613/top81 tiq00 40 external event count input/capture trigger input/external trigger input (tmq0), 5 v tolerant p53/sib2/kr3/toq00/rtp03/ ddo tiq01 37 p50/kr0/toq01/rtp00 tiq02 38 p51/kr1/toq02/rtp01 tiq03 39 input capture trigger input (tmq0), 5v tolerant p52/kr2/toq03/rtp02/ddi top00 27 p32/ascka0/sckb4/tip00 top01 28 timer output (tmp0) n-ch open-drain output selectable, 5 v tolerant p33/tip01 top10 29 p34/tip10 top11 30 timer output (tmp1) n-ch open-drain output selectable, 5 v tolerant p35/tip11 top20 68 p97/a7/sib1/tip20 top21 67 timer output (tmp2) n-ch open-drain output selectable, 5 v tolerant p96/a6/tip21 top30 66 p95/a5/tip30 top31 65 timer output (tmp3) n-ch open-drain output selectable, 5 v tolerant p94/a4/tip31 top40 64 p93/a3/tip40 top41 63 timer output (tmp4) n-ch open-drain output selectable, 5 v tolerant p92/a2/tip41 top50 76 p915/a15/intp6/tip50 top51 75 timer output (tmp5) n-ch open-drain output selectable, 5 v tolerant p914/a14/intp5/tip51 top60 7 p01/tip60 top61 6 timer output (tmp6) n-ch open-drain output selectable, 5 v tolerant p00/tip61 top70 52 p69/tip70 top71 54 timer output (tmp7) n-ch open-drain output selectable, 5 v tolerant p611 top80 55 p612/tip80 top81 56 output timer output (tmp8) n-ch open-drain output selectable, 5 v tolerant p613/tip81 toq00 40 p53/sib2/kr3/tiq00/rtp03/ddo toq01 37 p50/tiq01/kr0/rtp00 toq02 38 p51/rtp01/kr1/tiq02 toq03 39 output timer output (tmq0) n-ch open-drain output selectable 5 v tolerant p52/tiq03/kr2/rtp02/ddi txda0 25 p30/sob4 txda1 61 p90/a0/kr6/sda02 txda2 35 p38/sda00 txda3 60 output serial transmit data output (uarta0 to uarta3) n-ch open-drain output selectable 5 v tolerant p81
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 39 (6/6) pin name pin no. i/o function alternate function v dd 9 ? positive power supply pin for internal ? v ss 11 ? ground potential for internal ? wait 85 input external wait input pcm0 wr0 95 write strobe for external memory (lower 8 bits) pct0 wr1 96 output write strove for external memory (higher 8 bits) pct1 x1 12 input ? x2 13 ? connection of resonator for main clock ? xt1 15 input ? xt2 16 ? connection of resonator for subclock ?
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 40 2.2 pin states the operation states of pins in the various modes are described below. table 2-2. pin operation states in various modes pin name when power is turned on note 1 during reset (except when power is turned on) halt mode note 2 idle1, idle2, sub-idle mode note 2 stop mode note 2 idle state note 3 bus hold p05/drst pulled down pulled down note 4 held held held held held p10/ano0, p11/ano1 hi-z held held hi-z held held p53/ddo undefined hi-z note 5 held held held held held ad0 to ad15 notes 7, 8 a0 to a15 undefined notes 7, 9 a16 to a23 undefined note 7 hi-z hi-z held hi-z wait ? ? ? ? ? clkout operating l l operating operating wr0, wr1 rd astb h note 7 hi-z hldak h h h l hldrq operating note 7 ? ? ? operating cs0 to cs3 hi-z note 6 hi-z note 6 h note 7 h h held hi-z other port pins hi-z hi-z held held held held held notes 1. duration until 1 ms elapses after the supply voltage reaches the operating supply voltage range (lower limit) when the power is turned on. 2. operates while alternat e functions are operating. 3. in separate bus mode, the state of the pins in the id le state inserted after the t2 state is shown. in multiplexed bus mode, the state of the pins in the idle state inserted after the t3 state is shown. 4. pulled down during external reset. during internal reset by the watchdog timer, clock monitor, etc., the state of this pin differs according to the ocdm.ocdm0 bit setting. 5. ddo output is specified in the on-chip debug mode. 6. the bus control pins function alternately as port pins, so they are initialized to the input mode (port mode). 7. operates even in the halt mode, during dma operation. 8. in separate bus mode: hi-z in multiplexed bus mode: undefined 9. in separate bus mode remark hi-z: high impedance held: the state during the immediately preceding external bus cycle is held. l: low-level output h: high-level output ? : input without sampling (not acknowledged)
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 41 2.3 pin i/o circuit types, i/o buffer powe r supplies and connection of unused pins (1/3) pin alternate function pin no. i/o circuit type recommended connection p00 tip61/top61 6 p01 tip60/top60 7 p02 nmi 17 p03 intp0/adtrg 18 p04 intp1 19 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. p05 intp2/drst 20 10-n input: independently connect to ev ss via a resistor. fixing to v dd level is prohibited. output: leave open. internally pull-down after reset by reset pin. p06 intp3 21 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. p10, p11 ano0, ano1 3, 4 12-d input: independently connect to av ref1 or av ss via a resistor. output: leave open. p30 txda0/sob4 25 10-g p31 rxda0/intp7/sib4 26 p32 ascka0/sckb4/tip00 27 p33 tip01/top01 28 p34 tip10/top10 29 p35 tip11/top11 30 10-d p36 ? 31 p37 ? 32 10-g p38 txda2/sda00 35 p39 rxda2/scl00 36 p40 sib0/sda01 22 p41 sob0/scl01 23 p42 sckb0 24 p50 tiq01/kr0/toq01/rtp00 37 p51 tiq02/kr1/toq02/rtp01 38 p52 tiq03/kr2/toq03/rtp02/ddi 39 p53 sib2/kr3/tiq00/toq00/rtp03/ ddo 40 p54 sob2/kr4/rtp04/dck 41 p55 sckb2/kr5/rtp05/dms 42 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 42 (2/3) pin alternate function pin no. i/o circuit type recommended connection p60 to p65 rtp10 to rtp15 43 to 48 10-g p66 sib5 49 10-d p67 sob5 50 10-g p68 sckb5 51 p69 tip70/top70 52 p610 tip71 53 10-d p611 top71 54 10-g p612 tip80/top80 55 p613 tip81/top81 56 10-d p614, p615 ? 57, 58 10-g input: independently connect to ev dd or ev ss via a resistor. output: leave open. p70 to p715 ani0 to ani15 144 to 129 11-g input: independently connect to av ref0 or av ss via a resistor. output: leave open. p80 rxda3, intp8 59 10-d p81 txda3 60 10-g p90 a0/kr6/tdxa1/sda02 61 p91 a1/kr7/rxda1/scl02 62 p92 a2/tip41/top41 63 p93 a3/tip40/top40 64 p94 a4/tip31/top31 65 p95 a5/tip30/top30 66 p96 a6/tip21/top21 67 p97 a7/sib1/tip20/top20 68 10-d p98 a8/sob1 69 10-g p99 a9/sckb1 70 p910 a10/sib3 71 10-d p911 a11/sob3 72 10-g p912 a12/sckb3 73 p913 a13/intp4 74 p914 a14/intp5/tip51/top51 75 p915 a15/intp6/tip50/top50 76 10-d input: independently connect to ev dd or ev ss via a resistor. output: leave open. pcd0 to pcd3 ? 77 to 80 pcm0 wait 85 pcm1 clkout 86 pcm2 hldak 87 pcm3 hldrq 88 pcm4, pcm5 ? 89, 90 pcs0 to pcs3 cs0 to cs3 81 to 84 pcs4 to pcs7 ? 91 to 94 5 input: independently connect to bv dd or bv ss via a resistor. output: leave open.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 43 (3/3) pin alternate function pin no. i/o circuit type recommended connection pct0, pct1 wr0, wr1 95, 96 pct2, pct3 ? 97, 98 pct4 rd 99 pct5 ? 100 pct6 astb 101 pct7 ? 102 pdh0 to pdh7 a16 to a23 121 to 128 pdl0 to pdl4 ad0 to ad4 105 to 109 pdl5 ad5/flmd1 110 pdl6 to pdl15 ad6 to ad15 111 to 120 5 input: independently connect to bv dd or bv ss via a resistor. output: leave open. av ref0 ? 1 ? av ref1 ? 5 ? always connect this pin to the power supply (also in the standby mode). av ss ? 2 ? always connect this pin directly to the ground (also in the standby mode). bv dd ? 104 ? always connect this pin to the power supply (also in the standby mode). bv ss ? 103 ? always connect this pin directly to the ground (also in the standby mode). ev dd ? 34 ? always connect this pin to the power supply (also in the standby mode). ev ss ? 33 ? always connect this pin to the ground (also in the standby mode). flmd0 ? 8 ? connect to v ss in a mode other than the flash memory programming mode. regc ? 10 ? connect regulator output stabilization capacitance (4.7 f (preliminary value)) reset ? 14 2 ? v dd ? 9 ? always connect this pin to the power supply (also in the standby mode). v ss ? 11 ? always connect this pin directly to the ground (also in the standby mode). x1 ? 12 ? ? x2 ? 13 ? ? xt1 ? 15 16 connect to v ss . xt2 ? 16 16 leave open.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 44 figure 2-1. pin i/o circuits in data output disable p-ch in/out ev dd /bv dd ev ss /bv ss n-ch input enable data output disable ev dd ev ss p-ch in/out n-ch open drain input enable data output disable av ref0 p-ch in/out n-ch p-ch n-ch av ref0 input enable + _ av ss av ss data output disable input enable av ref1 p-ch in/out n-ch p-ch n-ch av ss data output disable ev dd ev ss p-ch in/out n-ch open drain input enable n-ch p-ch feedback cut-off xt1 xt2 data output disable ev dd ev ss p-ch in/out n-ch open drain input enable type 2 schmitt-triggered input with hysteresis characteristics type 5 type 10-n type 11-g type 12-d type 10-d type 16 type 10-g analog output voltage (threshold voltage) note note ocdm0 bit note hysteresis characteristics are not available in port mode.
chapter 2 pin functions preliminary user's manual u17714ej1v0ud 45 2.4 cautions when the power is turned on, the following pins may output an undefined level temporarily, even during reset. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp03/ddo pin
preliminary user's manual u17714ej1v0ud 46 chapter 3 cpu function the cpu of the v850es/jj2 is based on risc architecture and executes almost all instructions with one clock by using a 5-stage pipeline. 3.1 features minimum instruction execution time: 50 ns (at 20 mhz operation) 30.5 s (with subclock (f xt ) = 32.768 khz operation) memory space program (physical address) space: 64 mb linear data (logical address) space: 4 gb linear general-purpose registers: 32 bits 32 registers internal 32-bit architecture 5-stage pipeline control multiplication/division instruction saturation operation instruction 32-bit shift instruction: 1 clock load/store instruction with long/short format four types of bit manipulation instructions ? set1 ? clr1 ? not1 ? tst1
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 47 3.2 cpu register set the registers of the v850es/jj2 can be classified into two types: general-purpose program registers and dedicated system registers. all the registers are 32 bits wide. for details, refer to the v850es architecture user's manual . (1) program register set (2) system register set r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 (zero register) (assembler-reserved register) (stack pointer (sp)) (global pointer (gp)) (text pointer (tp)) (element pointer (ep)) (link pointer (lp)) pc (program counter) psw (program status word) ecr (interrupt source register) fepc fepsw (nmi status saving register) (nmi status saving register) eipc eipsw (interrupt status saving register) (interrupt status saving register) 31 0 31 0 31 0 ctbp (callt base pointer) dbpc dbpsw (exception/debug trap status saving register) (exception/debug trap status saving register) ctpc ctpsw (callt execution status saving register) (callt execution status saving register)
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 48 3.2.1 program register set the program registers include general-p urpose registers and a program counter. (1) general-purpose registers (r0 to r31) thirty-two general-purpose registers, r0 to r31, are av ailable. any of these registers can be used to store a data variable or an address variable. however, r0 and r30 are implicitly used by instructions and care must be exercised when these registers are used. r0 always holds 0 and is used for an operation that uses 0 or addressing of offset 0. r30 is used by the sld and sst instructions as a base pointer when these in structions access the memory. r1, r3 to r5, and r31 are implicitly used by the assembler and c compiler. when using these registers, save their contents for protection, and then restore the contents after using the registers. r2 is sometimes used by the real-time os. if the real-time os does not use r2, it can be used as a register for variables. table 3-1. program registers name usage operation r0 zero register always holds 0. r1 assembler-reserved register used as work ing register to create 32-bit immediate data r2 register for address/data variable (if real-time os does not use r2) r3 stack pointer used to create a stack frame when a function is called r4 global pointer used to access a global variable in the data area r5 text pointer used as register that i ndicates the beginning of a text area (area where program codes are located) r6 to r29 register for address/data variable r30 element pointer used as base pointer to access memory r31 link pointer used when t he compiler calls a function pc program counter holds the instruction address during program execution remark for furthers details on the r1, r3 to r5, and r31 that are used in the assembler and c compiler, refer to the ca850 (c compiler package) a ssembly language user's manual . (2) program counter (pc) the program counter holds the instructi on address during program execution. the lower 26 bits of this register are valid. bits 31 to 26 are fixed to 0. a carry from bit 25 to 26 is ignored even if it occurs. bit 0 is fixed to 0. this means that execution cannot branch to an odd address. 31 26 25 1 0 pc fixed to 0 instruction address during program execution 0 default value 00000000h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 49 3.2.2 system register set the system registers control the status of the cpu and hold interrupt information. these registers can be read or written by using system register load/sto re instructions (ldsr and stsr), using the system register numbers listed below. table 3-2. system register numbers operand specification system register number system register name ldsr instruction stsr instruction 0 interrupt status saving register (eipc) note 1 1 interrupt status saving register (eipsw) note 1 2 nmi status saving register (fepc) note 1 3 nmi status saving register (fepsw) note 1 4 interrupt source register (ecr) 5 program status word (psw) 6 to 15 reserved for future function expansion (operation is not guaranteed if these registers are accessed) 16 callt execution status saving register (ctpc) 17 callt execution status saving register (ctpsw) 18 exception/debug trap status saving register (dbpc) note 2 note 2 19 exception/debug trap status saving register (dbpsw) note 2 note 2 20 callt base pointer (ctbp) 21 to 31 reserved for future function expansion (operation is not guaranteed if these registers are accessed) notes 1. because only one set of these registers is availa ble, the contents of these registers must be saved by program if multiple interrupts are enabled. 2. these registers can be accessed only during th e interval between the execution of the dbtrap instruction or illegal opcode and the dbret instruction. caution even if eipc or fepc, or bit 0 of ctpc is set to 1 by the ldsr instruction, bit 0 is ignored when execution is returned to the main routine by the reti instruction after interrupt ser vicing (this is because bit 0 of the pc is fixed to 0). set an even value to eipc, fepc, and ctpc (bit 0 = 0). remark : can be accessed : access prohibited
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 50 (1) interrupt status saving registers (eipc and eipsw) eipc and eipsw are used to save the status when an interrupt occurs. if a software exception or a maskable interrupt occurs, th e contents of the program counter (pc) are saved to eipc, and the contents of the program status word ( psw) are saved to eipsw (these contents are saved to the nmi status saving registers (fepc and f epsw) if a non-maskable interrupt occurs). the address of the instruction next to the instruction under execution, except some instructions (see 19.8 periods in which interrupts are not acknowledged by cpu ), is saved to eipc when a software exception or a maskable interrupt occurs. the current contents of the psw are saved to eipsw. because only one set of interrupt status saving registers is available, the contents of these registers must be saved by program when multiple interrupts are enabled. bits 31 to 26 of eipc and bits 31 to 8 of eipsw are reserved for future function expansion (these bits are always fixed to 0). the value of eipc is restored to the pc and the val ue of eipsw to the psw by the reti instruction. 31 0 eipc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 eipsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 51 (2) nmi status saving registers (fepc and fepsw) fepc and fepsw are used to save the status when a non-maskable interrupt (nmi) occurs. if an nmi occurs, the contents of the program counter (pc) are saved to fepc, and those of the program status word (psw) are saved to fepsw. the address of the instruction next to the one of the instruction under exec ution, except some instructions, is saved to fepc when an nmi occurs. the current contents of t he psw are saved to fepsw. because only one set of nmi status saving registers is avai lable, the contents of thes e registers must be saved by program when multiple interrupts are enabled. bits 31 to 26 of fepc and bits 31 to 8 of fepsw are re served for future function expansion (these bits are always fixed to 0). the value of fepc is restored to the pc and the value of fepsw to the psw by the reti instruction. 31 0 fepc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 fepsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (3) interrupt source register (ecr) the interrupt source register (ecr) hol ds the source of an exception or in terrupt if an exception or interrupt occurs. this register holds the exception code of each interrupt source. because this register is a read-only register, data cannot be written to this register using the ldsr instruction. 31 0 ecr fecc eicc default value 00000000h 16 15 bit position bit name meaning 31 to 16 fecc exception code of non-maskable interrupt (nmi) 15 to 0 eicc exception code of exception or maskable interrupt
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 52 (4) program status word (psw) the program status word (psw) is a collection of flags that indicate th e status of the program (result of instruction execution) and the status of the cpu. if the contents of a bit of this regi ster are changed by using the ldsr instruction, the new contents are validated immediately after completion of ldsr instructi on execution. however if the id flag is set to 1, interrupt requests will not be acknowledged while the ldsr instruction is being executed. bits 31 to 8 of this register are reserved for future function expansion (these bits are fixed to 0). (1/2) 31 0 psw rfu default value 00000020h 87 np 6 ep 5 id 4 sat 3 cy 2 ov 1 sz bit position flag name meaning 31 to 8 rfu reserved field. fixed to 0. 7 np indicates that a non-maskable interrupt (nmi) is being serviced. this bit is set to 1 when an nmi request is acknowledged, disabling multiple interrupts. 0: nmi is not being serviced. 1: nmi is being serviced. 6 ep indicates that an exception is being proces sed. this bit is set to 1 when an exception occurs. even if this bit is set, interrupt requests are acknowledged. 0: exception is not being processed. 1: exception is being processed. 5 id indicates whether a maskable interrupt can be acknowledged. 0: interrupt enabled 1: interrupt disabled 4 sat note indicates that the result of a saturation operation has overflowed and is saturated. because this is a cumulative flag, it is set to 1 when the result of a saturation operation instruction is saturated, and is not cleared to 0 even if the subsequent operation result is not saturated. use the ldsr instruction to clear this bit. th is flag is neither set to 1 nor cleared to 0 by execution of an arithmetic operation instruction. 0: not saturated 1: saturated 3 cy indicates whether a ca rry or a borrow occurs as a result of an operation. 0: carry or borrow does not occur. 1: carry or borrow occurs. 2 ov note indicates whether an overflow occurs during operation. 0: overflow does not occur. 1: overflow occurs. 1 s note indicates whether the result of an operation is negative. 0: the result is positive or 0. 1: the result is negative. 0 z indicates whether the result of an operation is 0. 0: the result is not 0. 1: the result is 0. remark also read note on the next page.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 53 (2/2) note the result of the operation that has performed satura tion processing is determined by the contents of the ov and s flags. the sat flag is set to 1 only when the ov flag is set to 1 when a saturation operation is performed. flag status status of operation result sat ov s result of operation of saturation processing maximum positive value is exceeded 1 1 0 7fffffffh maximum negative value is exceeded 1 1 1 80000000h positive (maximum value is not exceeded) 0 negative (maximum value is not exceeded) holds value before operation 0 1 operation result itself (5) callt execution status saving registers (ctpc and ctpsw) ctpc and ctpsw are callt execution status saving registers. when the callt instruction is execut ed, the contents of the program count er (pc) are saved to ctpc, and those of the program status wo rd (psw) are saved to ctpsw. the contents saved to ctpc are the address of the inst ruction next to callt. the current contents of t he psw are saved to ctpsw. bits 31 to 26 of ctpc and bits 31 to 8 of ctpsw are reserved for future function expansion (fixed to 0). 31 0 ctpc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 ctpsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 54 (6) exception/debug trap status saving registers (dbpc and dbpsw) dbpc and dbpsw are exception/debug trap status registers. if an exception trap or debug trap occurs, the contents of the program counter (pc) are saved to dbpc, and those of the program status word (psw) are saved to dbpsw. the contents to be saved to dbpc are the address of th e instruction next to the one that is being executed when an exception trap or debug trap occurs. the current contents of t he psw are saved to dbpsw. this register can be read or written only during the in terval between the execution of the dbtrap instruction or illegal opcode and the dbret instruction. bits 31 to 26 of dbpc and bits 31 to 8 of dbpsw are reserved for future function expansion (fixed to 0). the value of dbpc is restored to the pc and the value of dbpsw to the psw by the dbret instruction. 31 0 dbpc (saved pc contents) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 31 0 dbpsw (saved psw contents) 0 0 default value 000000xxh (x: undefined) 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (7) callt base pointer (ctbp) the callt base pointer (ctbp) is used to specify a table address or generate a target address (bit 0 is fixed to 0). bits 31 to 26 of this register are reserved for future function expansion (fixed to 0). 31 0 ctbp (base address) 0 0 default value 0xxxxxxxh (x: undefined) 26 25 0 0 0 0 0
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 55 3.3 operation modes the v850es/jj2 has the following operation modes. (1) normal operation mode in this mode, each pin related to the bus interface is set to the port mode after system reset has been released. execution branches to the reset entry address of the intern al rom, and then instruction processing is started. (2) flash memory programming mode in this mode, the internal flash memory can be programmed by using a flash programmer. (3) on-chip debug mode the v850es/jj2 is provided with an on -chip debug function that employs t he jtag (joint test action group) communication specifications. for details, see chapter 27 on-chip debug function . 3.3.1 specifying operation mode specify the operation mode by using the flmd0 and flmd1 pins. in the normal mode, input a low level to the flmd0 pin when reset is released. in the flash memory programming mode, a high level is input to the flmd0 pin from the flash programmer if a flash programmer is connected, but it must be input from an external circuit in the self-programming mode. operation when reset is released flmd0 flmd1 operation mode after reset l normal operation mode h l flash memory programming mode h h setting prohibited remark l: low-level input h: high-level input : don't care
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 56 3.4 address space 3.4.1 cpu address space for instruction addressing, up to a combined total of 16 mb of an external memory area and an internal rom area, plus an internal ram area, are supported in a linear address space (program space) of up to 64 mb. for operand addressing (data access), up to 4 gb of a linear address spac e (data space) is supported. the 4 gb address space, however, is viewed as 64 images of a 64 mb physical address space. this means that the same 64 mb physical address space is accessed regardless of the value of bits 31 to 26. figure 3-1. image on address space program space internal ram area use-prohibited area use-prohibited area external memory area internal rom area (external memory area) data space image 63 image 1 image 0 peripheral i/o area internal ram area use-prohibited area external memory area internal rom area (external memory area) 16 mb 4 gb 64 mb 64 mb
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 57 3.4.2 wraparound of cpu address space (1) program space of the 32 bits of the pc (program counter), the higher 6 bits are fixed to 0 and only the lower 26 bits are valid. the higher 6 bits ignore a carry or borrow from bit 25 to 26 during branch address calculation. therefore, the highest address of the program space, 03ffffffh, and t he lowest address, 00000000h, are contiguous addresses. that the highest address and the lowest address of the program space are contiguous in this way is called wraparound. caution because the 4 kb area of addresses 03fff000h to 03ffffffh is an on-chip peripheral i/o area, instructions cannot be fetc hed from this area. therefore , do not execute an operation in which the result of a branch addr ess calculation affects this area. program space program space (+) direction ( ? ) direction 00000001h 00000000h 03ffffffh 03fffffeh (2) data space the result of an operand address calculation oper ation that exceeds 32 bits is ignored. therefore, the highest address of the data space, ffffffffh, and the lowest address, 00000000h, are contiguous, and wraparound occurs at the boundary of these addresses. data space data space (+) direction ( ? ) direction 00000001h 00000000h ffffffffh fffffffeh
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 58 3.4.3 memory map the areas shown below are reserved in the v850es/jj2. figure 3-2. data memory map (physical addresses) (64 kb) use prohibited external memory area (14 mb) internal rom area note (1 mb) external memory area (1 mb) internal ram area (60 kb) on-chip peripheral i/o area (4 kb) (2 mb) 03ffffffh 03ff0000h 01000000h 00ffffffh 00200000h 001fffffh 00000000h 03feffffh 03ffffffh 03fff000h 03ffefffh 03ff0000h 001fffffh 00100000h 000fffffh 00000000h note fetch access and read access to addresses 00000000h to 000fffffh is made to the internal rom area. however, data write access to these addresses is made to the external memory area.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 59 figure 3-3. program memory map internal ram area (60 kb) use prohibited (program fetch prohibited area) use prohibited (program fetch prohibited area) external memory area (14 mb) external memory area (1 mb) internal rom area (1 mb) 03ffffffh 03fff000h 03ffefffh 01000000h 00ffffffh 03ff0000h 03feffffh 00200000h 001fffffh 00100000h 000fffffh 00000000h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 60 3.4.4 areas (1) internal rom area up to 1 mb is reserved as an internal rom area. (a) internal rom (128 kb) 128 kb are allocated to addresses 00000000h to 0001ffffh in the pd70f3720. accessing addresses 00020000h to 000fffffh is prohibited. figure 3-4. internal rom area (128 kb) access-prohibited area internal rom (128 kb) 000ffffh 00020000h 0001ffffh 00000000h (b) internal rom (256 kb) 256 kb are allocated to addresses 00000000h to 0003ffffh in the pd70f3721. accessing addresses 00040000h to 000fffffh is prohibited. figure 3-5. internal rom area (256 kb) access-prohibited area internal rom (256 kb) 000fffffh 00040000h 0003ffffh 00000000h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 61 (c) internal rom (384 kb) 384 kb are allocated to addresses 00000000h to 0005ffffh in the pd70f3722. accessing addresses 00060000h to 000fffffh is prohibited. figure 3-6. internal rom area (384 kb) access-prohibited area internal rom (384 kb) 00060000h 0005ffffh 00000000h 000fffffh (d) internal rom (512 kb) 512 kb are allocated to addresses 00000000h to 0007ffffh in the pd70f3723. accessing addresses 00080000h to 000fffffh is prohibited. figure 3-7. internal rom area (512 kb) access-prohibited area internal rom (512 kb) 000ffffh 00080000h 0007ffffh 00000000h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 62 (e) internal rom (640 kb) 640 kb are allocated to addresses 00000000h to 0009ffffh in the pd70f3724. accessing addresses 000a0000h to 000fffffh is prohibited. figure 3-8. internal rom area (640 kb) access-prohibited area internal rom (640 kb) 000a0000h 0009ffffh 00000000h 000fffffh
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 63 (2) internal ram area up to 60 kb are reserved as the internal ram area. (a) internal ram (12 kb) 12 kb are allocated to addresses 03ffc000h to 03ffefffh in the pd70f3720. accessing addresses 03ff0000h to 03ffbfffh is prohibited. figure 3-9. internal ram area (12 kb) access-prohibited area internal ram 03ffefffh ffffefffh ffffc000h ffffbfffh ffff0000h 03ffc000h 03ffbfffh 03ff0000h physical address space logical address space (b) internal ram (24 kb) 24 kb are allocated to addresses 03ff9000h to 03ffefffh in the pd70f3721. accessing addresses 03ff0000h to 03ff8fffh is prohibited. figure 3-10. internal ram area (24 kb) access-prohibited area internal ram 03ffefffh ffffefffh 03ff9000h ffff9000h 03ff8fffh ffff8fffh 03ff0000h ffff0000h physical address space logical address space
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 64 (c) internal ram (32 kb) 32 kb are allocated to addresses 03ff7000h to 03ffefffh in the pd70f3722. accessing addresses 03ff0000h to 03ff6fffh is prohibited. figure 3-11. internal ram area (32 kb) access-prohibited area internal ram 03ff7000h 03ff6fffh 03ff0000h 03ffefffh ffff7000h ffff6fffh ffff0000h ffffefffh physical address space logical address space (d) internal ram (40 kb) 40 kb are allocated to addresses 03ff5000h to 03ffefffh in the pd70f3723. accessing addresses 03ff0000h to 03ff4fffh is prohibited. figure 3-12. internal ram area (40 kb) access-prohibited area internal ram 03ffefffh ffffefffh 03ff5000h ffff5000h 03ff4fffh ffff4fffh 03ff0000h ffff0000h physical address space logical address space
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 65 (e) internal ram (48 kb) 48 kb are allocated to addresses 03ff3000h to 03ffefffh in the pd70f3724. accessing addresses 03ff0000h to 03ff2fffh is prohibited. figure 3-13. internal ram area (48 kb) access-prohibited area internal ram 03ff3000h 03ff2fffh 03ff0000h 03ffefffh ffff3000h ffff2fffh ffff0000h ffffefffh physical address space logical address space
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 66 (3) on-chip peripheral i/o area 4 kb of addresses 03fff000h to 03ffffffh are re served as the on-chip peripheral i/o area. figure 3-14. on-chip peripheral i/o area on-chip peripheral i/o area (4 kb) 03ffffffh 03fff000h ffffffffh fffff000h physical address space logical address space peripheral i/o registers that have functions to specif y the operation mode for and mo nitor the status of the on- chip peripheral i/o are mapped to the on-chip periphe ral i/o area. program cannot be fetched from this area. cautions 1. when a register is accessed in word units, a word area is accessed twice in halfword units in the order of lower area and higher area, with the lower 2 bits of the address ignored. 2. if a register that can be accessed in byte units is accessed in halfword units, the higher 8 bits are undefined when the register is read , and data is written to the lower 8 bits. 3. addresses not defined as registers are r eserved for future expansion. the operation is undefined and not guaranteed when these addresses are accessed. (4) external memory area 15 mb (00100000h to 00ffffffh) are allocated as th e external memory area. for details, see chapter 5 bus control function .
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 67 3.4.5 recommended use of address space the architecture of the v850es/jj2 re quires that a register that serves as a pointer be secured for address generation when operand data in the data space is accessed. the address stored in this pointer 32 kb can be directly accessed by an instruction for operand data. beca use the number of general-purpose registers that can be used as a pointer is limited, however, by keeping the pe rformance from dropping during address calculation when a pointer value is changed, as many general-purpose registers as possible can be secured for variables, and the program size can be reduced. (1) program space of the 32 bits of the pc (program counte r), the higher 6 bits are fixed to 0, and only the lower 26 bits are valid. regarding the program space, therefore, a 64 mb spac e of contiguous addresses starting from 00000000h unconditionally corresponds to the memory map. to use the internal ram area as the program space, access following addresses. caution if a branch instruction is at the upper limi t of the internal ram ar ea, a prefetch operation (invalid fetch) straddling the on-chip peripheral i/o area does not occur. ram size access address 48 kb 03ff3000h to 03ffefffh 40 kb 03ff5000h to 03ffefffh 32 kb 03ff7000h to 03ffefffh 24 kb 03ff9000h to 03ffefffh 12 kb 03ffc000h to 03ffefffh
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 68 (2) data space with the v850es/jj2, it seems that there are sixty-four 64 mb addres s spaces on the 4 gb cpu address space. therefore, the least significant bit (bit 25) of a 26-bit address is sign-extended to 32 bits and allocated as an address. (a) application example of wraparound if r = r0 (zero register) is specified for the ld/st di sp16 [r] instruction, a range of addresses 00000000h 32 kb can be addressed by sign-extended disp16. all the resources, including the internal hardware, can be addressed by one pointer. the zero register (r0) is a register fixed to 0 by har dware, and practically eliminates the need for registers dedicated to pointers. example : pd70f3722 internal rom area on-chip peripheral i/o area internal ram area 3 2 kb 4 kb 28 kb (r = ) 0005ffffh 00007fffh 00000000h fffff000h ffffefffh ffff8000h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 69 figure 3-15. recommended memory map data space program space on-chip peripheral i/o on-chip peripheral i/o internal ram internal ram internal rom external memory use prohibited external memory use prohibited internal ram program space 64 mb internal rom internal rom ffffffffh fffff000h ffffefffh ffff0000h fffeffffh 04000000h 03ffffffh 03fff000h 03ffefffh 03ff7000h 03ff6fffh 03ff0000h 03feffffh 01000000h 00ffffffh 00060000h 0005ffffh 00100000h 000fffffh 00000000h ffffffffh fffff000h ffffefffh ffff7000h ffff6fffh ffff0000h fffeffffh 00100000h 000fffffh 00000000h use prohibited remarks 1. indicates the recommended area. 2. this figure is the recommended memory map of the pd70f3722.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 70 3.4.6 peripheral i/o registers (1/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff004h port dl register pdl 0000h note fffff004h port dll register pdll 00h note fffff005h port dlh register pdlh 00h note fffff006h port dh register pdh 00h note fffff008h port cs register pcs 00h note fffff00ah port ct register pct 00h note fffff00ch port cm register pcm 00h note fffff00eh port cd register pcd 00h note fffff024h port dl mode register pmdl ffffh fffff024h port dl mode register l pmdll ffh fffff025h port dl mode register h pmdlh ffh fffff026h port dh mode register pmdh ffh fffff028h port cs mode register pmcs ffh fffff02ah port ct mode register pmct ffh fffff02ch port cm mode register pmcm ffh fffff02eh port cd mode register pmcd ffh fffff044h port dl mode control register pmcdl 0000h fffff044h port dl mode control register l pmcdll 00h fffff045h port dl mode control register h pmcdlh 00h fffff046h port dh mode control register pmcdh 00h fffff048h port cs mode control register pmccs 00h fffff04ah port ct mode control register pmcct 00h fffff04ch port cm mode control register pmccm 00h fffff066h bus size configuration register bsc 5555h fffff06eh system wait control register vswc 77h fffff080h dma source address register 0l dsa0l undefined fffff082h dma source address register 0h dsa0h undefined fffff084h dma destination address register 0l dda0l undefined fffff086h dma destination address register 0h dda0h undefined fffff088h dma source address register 1l dsa1l undefined fffff08ah dma source address register 1h dsa1h undefined fffff08ch dma destination address register 1l dda1l undefined fffff08eh dma destination address register 1h dda1h undefined fffff090h dma source address register 2l dsa2l undefined fffff092h dma source address register 2h dsa2h undefined fffff094h dma destination address register 2l dda2l undefined fffff096h dma destination address register 2h dda2h undefined fffff098h dma source address register 3l dsa3l undefined fffff09ah dma source address register 3h dsa3h undefined fffff09ch dma destination address register 3l dda3l undefined fffff09eh dma destination address register 3h dda3h r/w undefined note the value of the output latch is 00h or 0000h. the status of the pin is read during input.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 71 (2/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff0c0h dma transfer count register 0 dbc0 undefined fffff0c2h dma transfer count register 1 dbc1 undefined fffff0c4h dma transfer count register 2 dbc2 undefined fffff0c6h dma transfer count register 3 dbc3 undefined fffff0d0h dma addressing control register 0 dadc0 0000h fffff0d2h dma addressing control register 1 dadc1 0000h fffff0d4h dma addressing control register 2 dadc2 0000h fffff0d6h dma addressing control register 3 dadc3 0000h fffff0e0h dma channel control register 0 dchc0 00h fffff0e2h dma channel control register 1 dchc1 00h fffff0e4h dma channel control register 2 dchc2 00h fffff0e6h dma channel control register 3 dchc3 00h fffff100h interrupt mask register 0 imr0 ffffh fffff100h interrupt mask register 0l imr0l ffh fffff101h interrupt mask register 0h imr0h ffh fffff102h interrupt mask register 1 imr1 ffffh fffff102h interrupt mask register 1l imr1l ffh fffff103h interrupt mask register 1h imr1h ffh fffff104h interrupt mask register 2 imr2 ffffh fffff104h interrupt mask register 2l imr2l ffh fffff105h interrupt mask register 2h imr2h ffh fffff106h interrupt mask register 3 imr3 ffffh fffff106h interrupt mask register 3l imr3l ffh fffff107h interrupt mask register 3h imr3h ffh fffff108h interrupt mask register 4 imr4 ffffh fffff108h interrupt mask register 4l imr4l ffh fffff109h interrupt mask register 4h imr4h ffh fffff110h interrupt control register lviic 47h fffff112h interrupt control register pic0 47h fffff114h interrupt control register pic1 47h fffff116h interrupt control register pic2 47h fffff118h interrupt control register pic3 47h fffff11ah interrupt control register pic4 47h fffff11ch interrupt control register pic5 47h fffff11eh interrupt control register pic6 47h fffff120h interrupt control register pic7 47h fffff122h interrupt control register tq0ovic 47h fffff124h interrupt control register tq0ccic0 47h fffff126h interrupt control register tq0ccic1 47h fffff128h interrupt control register tq0ccic2 47h fffff12ah interrupt control register tq0ccic3 47h fffff12ch interrupt control register tp0ovic 47h fffff12eh interrupt control register tp0ccic0 r/w 47h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 72 (3/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff130h interrupt control register tp0ccic1 47h fffff132h interrupt control register tp1ovic 47h fffff134h interrupt control register tp1ccic0 47h fffff136h interrupt control register tp1ccic1 47h fffff138h interrupt control register tp2ovic 47h fffff13ah interrupt control register tp2ccic0 47h fffff13ch interrupt control register tp2ccic1 47h fffff13eh interrupt control register tp3ovic 47h fffff140h interrupt control register tp3ccic0 47h fffff142h interrupt control register tp3ccic1 47h fffff144h interrupt control register tp4ovic 47h fffff146h interrupt control register tp4ccic0 47h fffff148h interrupt control register tp4ccic1 47h fffff14ah interrupt control register tp5ovic 47h fffff14ch interrupt control register tp5ccic0 47h fffff14eh interrupt control register tp5ccic1 47h fffff150h interrupt control register tm0eqic0 47h fffff152h interrupt control register cb0ric/iicic1 47h fffff154h interrupt control register cb0tic 47h fffff156h interrupt control register cb1ric 47h fffff158h interrupt control register cb1tic 47h fffff15ah interrupt control register cb2ric 47h fffff15ch interrupt control register cb2tic 47h fffff15eh interrupt control register cb3ric 47h fffff160h interrupt control register cb3tic 47h fffff162h interrupt control register ua0ric/cb4ric 47h fffff164h interrupt control register ua0tic/cb4tic 47h fffff166h interrupt control register ua1ric/iicic2 47h fffff168h interrupt control register ua1tic 47h fffff16ah interrupt control register ua2ric/iicic0 47h fffff16ch interrupt control register ua2tic 47h fffff16eh interrupt control register adic 47h fffff170h interrupt control register dmaic0 47h fffff172h interrupt control register dmaic1 47h fffff174h interrupt control register dmaic2 47h fffff176h interrupt control register dmaic3 47h fffff178h interrupt control register kric 47h fffff17ah interrupt control register wtiic 47h fffff17ch interrupt control register wtic 47h fffff18eh interrupt control register pic8 47h fffff190h interrupt control register tp6ovic 47h fffff192h interrupt control register tp6ccic0 47h fffff194h interrupt control register tp6ccic1 r/w 47h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 73 (4/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff196h interrupt control register tp7ovic 47h fffff198h interrupt control register tp7ccic0 47h fffff19ah interrupt control register tp7ccic1 47h fffff19ch interrupt control register tp8ovic 47h fffff19eh interrupt control register tp8ccic0 47h fffff1a0h interrupt control register tp8ccic1 47h fffff1a2h interrupt control register cb5ric 47h fffff1a4h interrupt control register cb5tic 47h fffff1a6h interrupt control register ua3ric 47h fffff1a8h interrupt control register ua3tic r/w 47h fffff1fah in-service priority register ispr r 00h fffff1fch command register prcmd w undefined fffff1feh power save control register psc 00h fffff200h a/d converter mode register 0 ada0m0 00h fffff201h a/d converter mode register 1 ada0m1 00h fffff202h a/d converter channel specification register ada0s 00h fffff203h a/d converter mode register 2 ada0m2 00h fffff204h power-fail compare mode register ada0pfm 00h fffff205h power-fail compare threshold value register ada0pft r/w 00h fffff210h a/d conversion result register 0 ada0cr0 undefined fffff211h a/d conversion result register 0h ada0cr0h undefined fffff212h a/d conversion result register 1 ada0cr1 undefined fffff213h a/d conversion result register 1h ada0cr1h undefined fffff214h a/d conversion result register 2 ada0cr2 undefined fffff215h a/d conversion result register 2h ada0cr2h undefined fffff216h a/d conversion result register 3 ada0cr3 undefined fffff217h a/d conversion result register 3h ada0cr3h undefined fffff218h a/d conversion result register 4 ada0cr4 undefined fffff219h a/d conversion result register 4h ada0cr4h undefined fffff21ah a/d conversion result register 5 ada0cr5 undefined fffff21bh a/d conversion result register 5h ada0cr5h undefined fffff21ch a/d conversion result register 6 ada0cr6 undefined fffff21dh a/d conversion result register 6h ada0cr6h undefined fffff21eh a/d conversion result register 7 ada0cr7 undefined fffff21fh a/d conversion result register 7h ada0cr7h undefined fffff220h a/d conversion result register 8 ada0cr8 undefined fffff221h a/d conversion result register 8h ada0cr8h undefined fffff222h a/d conversion result register 9 ada0cr9 undefined fffff223h a/d conversion result register 9h ada0cr9h undefined fffff224h a/d conversion result register 10 ada0cr10 undefined fffff225h a/d conversion result register 10h ada0cr10h r undefined
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 74 (5/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff226h a/d conversion result register 11 ada0cr11 undefined fffff227h a/d conversion result register 11h ada0cr11h undefined fffff228h a/d conversion result register 12 ada0cr12 undefined fffff229h a/d conversion result register 12h ada0cr12h undefined fffff22ah a/d conversion result register 13 ada0cr13 undefined fffff22bh a/d conversion result register 13h ada0cr13h undefined fffff22ch a/d conversion result register 14 ada0cr14 undefined fffff22dh a/d conversion result register 14h ada0cr14h undefined fffff22eh a/d conversion result register 15 ada0cr15 undefined fffff22fh a/d conversion result register 15h ada0cr15h r undefined fffff280h d/a conversion value setting register 0 da0cs0 00h fffff281h d/a conversion value setting register 1 da0cs1 00h fffff282h d/a converter mode register da0m 00h fffff300h key return mode register krm 00h fffff308h selector operation control register 0 selcnt0 00h fffff318h noise elimination control register nfc 00h fffff320h prescaler mode register 1 prsm1 00h fffff321h prescaler compare register 1 prscm1 00h fffff324h prescaler mode register 2 prsm2 00h fffff325h prescaler compare register 2 prscm2 00h fffff328h prescaler mode register 3 prsm3 00h fffff329h prescaler compare register 3 prscm3 00h fffff340h iic division clock select register 0 ocks0 00h fffff344h iic division clock select register 1 ocks1 00h fffff400h port 0 register p0 00h note fffff402h port 1 register p1 00h note fffff406h port 3 register p3 0000h note fffff406h port 3l register p3l 00h note fffff407h port 3h register p3h 00h note fffff408h port 4 register p4 00h note fffff40ah port 5 register p5 00h note fffff40ch port 6 register p6 0000h note fffff40ch port 6l register p6l 00h note fffff40dh port 6h register p6h 00h note fffff40eh port 7l register p7l 00h note fffff40fh port 7h register p7h 00h note fffff410h port 8 register p8 00h note fffff412h port 9 register p9 0000h note fffff412h port 9l register p9l 00h note fffff413h port 9h register p9h 00h note fffff420h port 0 mode register pm0 r/w ffh note the value of the output latch is 00h or 0000h. the status of the pin is read during input.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 75 (6/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff422h port 1 mode register pm1 ffh fffff426h port 3 mode register pm3 ffffh fffff426h port 3 mode register l pm3l ffh fffff427h port 3 mode register h pm3h ffh fffff428h port 4 mode register pm4 ffh fffff42ah port 5 mode register pm5 ffh fffff42ch port 6 mode register pm6 ffffh fffff42ch port 6 mode register l pm6l ffh fffff42dh port 6 mode register h pm6h ffh fffff42eh port 7 mode register l pm7l ffh fffff42fh port 7 mode register h pm7h ffh fffff430h port 8 mode register pm8 ffh fffff432h port 9 mode register pm9 ffffh fffff432h port 9 mode register l pm9l ffh fffff433h port 9 mode register h pm9h ffh fffff440h port 0 mode control register pmc0 00h fffff446h port 3 mode control register pmc3 0000h fffff446h port 3 mode control register l pmc3l 00h fffff447h port 3 mode control register h pmc3h 00h fffff448h port 4 mode control register pmc4 00h fffff44ah port 5 mode control register pmc5 00h fffff44ch port 6 mode control register pmc6 0000h fffff44ch port 6 mode control register l pmc6l 00h fffff44dh port 6 mode control register h pmc6h 00h fffff450h port 8 mode control register pmc8 00h fffff452h port 9 mode control register pmc9 0000h fffff452h port 9 mode control register l pmc9l 00h fffff453h port 9 mode control register h pmc9h 00h fffff460h port 0 function control register pfc0 00h fffff466h port 3 function control register pfc3 0000h fffff466h port 3 function control register l pfc3l 00h fffff467h port 3 function control register h pfc3h 00h fffff468h port 4 function control register pfc4 00h fffff46ah port 5 function control register pfc5 00h fffff46dh port 6 function control register h pfc6h 00h fffff472h port 9 function control register pfc9 0000h fffff472h port 9 function control register l pfc9l 00h fffff473h port 9 function control register h pfc9h 00h fffff484h data wait control register 0 dwc0 7777h fffff488h address wait control register awc ffffh fffff48ah bus cycle control register bcc r/w aaaah
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 76 (7/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff540h tmq0 control register 0 tq0ctl0 00h fffff541h tmq0 control register 1 tq0ctl1 00h fffff542h tmq0 i/o control register 0 tq0ioc0 00h fffff543h tmq0 i/o control register 1 tq0ioc1 00h fffff544h tmq0 i/o control register 2 tq0ioc2 00h fffff545h tmq0 option register 0 tq0opt0 00h fffff546h tmq0 capture/compare register 0 tq0ccr0 0000h fffff548h tmq0 capture/compare register 1 tq0ccr1 0000h fffff54ah tmq0 capture/compare register 2 tq0ccr2 0000h fffff54ch tmq0 capture/compare register 3 tq0ccr3 r/w 0000h fffff54eh tmq0 counter read buffer register tq0cnt r 0000h fffff590h tmp0 control register 0 tp0ctl0 00h fffff591h tmp0 control register 1 tp0ctl1 00h fffff592h tmp0 i/o control register 0 tp0ioc0 00h fffff593h tmp0 i/o control register 1 tp0ioc1 00h fffff594h tmp0 i/o control register 2 tp0ioc2 00h fffff595h tmp0 option register 0 tp0opt0 00h fffff596h tmp0 capture/compare register 0 tp0ccr0 0000h fffff598h tmp0 capture/compare register 1 tp0ccr1 r/w 0000h fffff59ah tmp0 counter read buffer register tp0cnt r 0000h fffff5a0h tmp1 control register 0 tp1ctl0 00h fffff5a1h tmp1 control register 1 tp1ctl1 00h fffff5a2h tmp1 i/o control register 0 tp1ioc0 00h fffff5a3h tmp1 i/o control register 1 tp1ioc1 00h fffff5a4h tmp1 i/o control register 2 tp1ioc2 00h fffff5a5h tmp1 option register 0 tp1opt0 00h fffff5a6h tmp1 capture/compare register 0 tp1ccr0 0000h fffff5a8h tmp1 capture/compare register 1 tp1ccr1 r/w 0000h fffff5aah tmp1 counter read buffer register tp1cnt r 0000h fffff5b0h tmp2 control register 0 tp2ctl0 00h fffff5b1h tmp2 control register 1 tp2ctl1 00h fffff5b2h tmp2 i/o control register 0 tp2ioc0 00h fffff5b3h tmp2 i/o control register 1 tp2ioc1 00h fffff5b4h tmp2 i/o control register 2 tp2ioc2 00h fffff5b5h tmp2 option register 0 tp2opt0 00h fffff5b6h tmp2 capture/compare register 0 tp2ccr0 0000h fffff5b8h tmp2 capture/compare register 1 tp2ccr1 r/w 0000h fffff5bah tmp2 counter read buffer register tp2cnt r 0000h fffff5c0h tmp3 control register 0 tp3ctl0 00h fffff5c1h tmp3 control register 1 tp3ctl1 00h fffff5c2h tmp3 i/o control register 0 tp3ioc0 00h fffff5c3h tmp3 i/o control register 1 tp3ioc1 00h fffff5c4h tmp3 i/o control register 2 tp3ioc2 r/w 00h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 77 (8/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff5c5h tmp3 option register 0 tp3opt0 00h fffff5c6h tmp3 capture/compare register 0 tp3ccr0 0000h fffff5c8h tmp3 capture/compare register 1 tp3ccr1 r/w 0000h fffff5cah tmp3 counter read buffer register tp3cnt r 0000h fffff5d0h tmp4 control register 0 tp4ctl0 00h fffff5d1h tmp4 control register 1 tp4ctl1 00h fffff5d2h tmp4 i/o control register 0 tp4ioc0 00h fffff5d3h tmp4 i/o control register 1 tp4ioc1 00h fffff5d4h tmp4 i/o control register 2 tp4ioc2 00h fffff5d5h tmp4 option register 0 tp4opt0 00h fffff5d6h tmp4 capture/compare register 0 tp4ccr0 0000h fffff5d8h tmp4 capture/compare register 1 tp4ccr1 r/w 0000h fffff5dah tmp4 counter read buffer register tp4cnt r 0000h fffff5e0h tmp5 control register 0 tp5ctl0 00h fffff5e1h tmp5 control register 1 tp5ctl1 00h fffff5e2h tmp5 i/o control register 0 tp5ioc0 00h fffff5e3h tmp5 i/o control register 1 tp5ioc1 00h fffff5e4h tmp5 i/o control register 2 tp5ioc2 00h fffff5e5h tmp5 option register 0 tp5opt0 00h fffff5e6h tmp5 capture/compare register 0 tp5ccr0 0000h fffff5e8h tmp5 capture/compare register 1 tp5ccr1 r/w 0000h fffff5eah tmp5 counter read buffer register tp5cnt r 0000h fffff5f0h tmp6 control register 0 tp6ctl0 00h fffff5f1h tmp6 control register 1 tp6ctl1 00h fffff5f2h tmp6 i/o control register 0 tp6ioc0 00h fffff5f3h tmp6 i/o control register 1 tp6ioc1 00h fffff5f4h tmp6 i/o control register 2 tp6ioc2 00h fffff5f5h tmp6 option register 0 tp6opt0 00h fffff5f6h tmp6 capture/compare register 0 tp6ccr0 0000h fffff5f8h tmp6 capture/compare register 1 tp6ccr1 r/w 0000h fffff5fah tmp6 counter read buffer register tp6cnt r 0000h fffff600h tmp7 control register 0 tp7ctl0 00h fffff601h tmp7 control register 1 tp7ctl1 00h fffff602h tmp7 i/o control register 0 tp7ioc0 00h fffff603h tmp7 i/o control register 1 tp7ioc1 00h fffff604h tmp7 i/o control register 2 tp7ioc2 00h fffff605h tmp7 option register 0 tp7opt0 00h fffff606h tmp7 capture/compare register 0 tp7ccr0 0000h fffff608h tmp7 capture/compare register 1 tp7ccr1 r/w 0000h fffff60ah tmp7 counter read buffer register tp7cnt r 0000h fffff610h tmp8 control register 0 tp8ctl0 00h fffff611h tmp8 control register 1 tp8ctl1 r/w 00h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 78 (9/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff612h tmp8 i/o control register 0 tp8ioc0 00h fffff613h tmp8 i/o control register 1 tp8ioc1 00h fffff614h tmp8 i/o control register 2 tp8ioc2 00h fffff615h tmp8 option register 0 tp8opt0 00h fffff616h tmp8 capture/compare register 0 tp8ccr0 0000h fffff618h tmp8 capture/compare register 1 tp8ccr1 r/w 0000h fffff61ah tmp8 counter read buffer register tp8cnt r 0000h fffff680h watch timer operation mode register wtm 00h fffff690h tmm0 control register 0 tm0ctl0 00h fffff694h tmm0 compare register 0 tm0cmp0 0000h fffff6c0h oscillation stabilization time select register osts 06h fffff6c1h pll lockup time specification register plls 03h fffff6d0h watchdog timer mode register 2 wdtm2 67h fffff6d1h watchdog timer enable register wdte 9ah fffff6e0h real-time output buffer register 0l rtbl0 00h fffff6e2h real-time output buffer register 0h rtbh0 00h fffff6e4h real-time output port mode register 0 rtpm0 00h fffff6e5h real-time output port control register 0 rtpc0 00h fffff6f0h real-time output buffer register 1l rtbl1 00h fffff6f2h real-time output buffer register 1h rtbh1 00h fffff6f4h real-time output port mode register 1 rtpm1 00h fffff6f5h real-time output port control register 1 rtpc1 00h fffff706h port 3 function control expansion register l pfce3l 00h fffff70ah port 5 function control expansion register pfce5 00h fffff712h port 9 function control expansion register pfce9 0000h fffff712h port 9 function control expansion register l pfce9l 00h fffff713h port 9 function control expansion register h pfce9h 00h fffff802h system status register sys 00h fffff80ch internal oscillation mode register rcm 00h fffff810h dma trigger factor register 0 dtfr0 00h fffff812h dma trigger factor register 1 dtfr1 00h fffff814h dma trigger factor register 2 dtfr2 00h fffff816h dma trigger factor register 3 dtfr3 00h fffff820h power save mode register psmr 00h fffff822h clock control register ckc r/w 0ah fffff824h lock register lockr r 00h fffff828h processor clock control register pcc 03h fffff82ch pll control register pllctl r/w 01h fffff82eh cpu operation clock status register ccls r 00h fffff870h clock monitor mode register clm 00h fffff888h reset source flag register resf 00h fffff890h low-voltage detection register lvim r/w 00h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 79 (10/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffff891h low-voltage detection level select register lvis 00h fffff892h internal ram data status register rams 01h fffff8b0h prescaler mode register 0 prsm0 00h fffff8b1h prescaler compare register 0 prscm0 00h fffff9fch on-chip debug mode register ocdm 01h fffff9feh peripheral emul ation register 1 pemu1 note 00h fffffa00h uarta0 control register 0 ua0ctl0 10h fffffa01h uarta0 control register 1 ua0ctl1 00h fffffa02h uarta0 control register 2 ua0ctl2 ffh fffffa03h uarta0 option control register 0 ua0opt0 14h fffffa04h uarta0 status register ua0str r/w 00h fffffa06h uarta0 receive data register ua0rx r ffh fffffa07h uarta0 transmit data register ua0tx ffh fffffa10h uarta1 control register 0 ua1ctl0 10h fffffa11h uarta1 control register 1 ua1ctl1 00h fffffa12h uarta1 control register 2 ua1ctl2 ffh fffffa13h uarta1 option control register 0 ua1opt0 14h fffffa14h uarta1 status register ua1str r/w 00h fffffa16h uarta1 receive data register ua1rx r ffh fffffa17h uarta1 transmit data register ua1tx ffh fffffa20h uarta2 control register 0 ua2ctl0 10h fffffa21h uarta2 control register 1 ua2ctl1 00h fffffa22h uarta2 control register 2 ua2ctl2 ffh fffffa23h uarta2 option control register 0 ua2opt0 14h fffffa24h uarta2 status register ua2str r/w 00h fffffa26h uarta2 receive data register ua2rx r ffh fffffa27h uarta2 transmit data register ua2tx ffh fffffa30h uarta3 control register 0 ua3ctl0 10h fffffa31h uarta3 control register 1 ua3ctl1 00h fffffa32h uarta3 control register 2 ua3ctl2 ffh fffffa33h uarta3 option control register 0 ua3opt0 14h fffffa34h uarta3 status register ua3str r/w 00h fffffa36h uarta3 receive data register ua3rx r ffh fffffa37h uarta3 transmit data register ua3tx ffh fffffc00h external interrupt falling edge specification register 0 intf0 00h fffffc06h external interrupt falling edge specification register 3 intf3 00h fffffc10h external interrupt falling edge specification register 8 intf8 00h fffffc13h external interrupt falling edge specification register 9h intf9h 00h fffffc20h external interrupt rising edge specification register 0 intr0 00h fffffc26h external interrupt rising edge specification register 3 intr3 00h fffffc30h external interrupt rising edge specification register 8 intr8 00h fffffc33h external interrupt rising edge specification register 9h intr9h r/w 00h note only during emulation
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 80 (11/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffffc60h port 0 function register pf0 00h fffffc66h port 3 function register pf3 0000h fffffc66h port 3 function register l pf3l 00h fffffc67h port 3 function register h pf3h 00h fffffc68h port 4 function register pf4 00h fffffc6ah port 5 function register pf5 00h fffffc6ch port 6 function register pf6 0000h fffffc6ch port 6 function register l pf6l 00h fffffc6dh port 6 function register h pf6h 00h fffffc70h port 8 function register pf8 00h fffffc72h port 9 function register pf9 0000h fffffc72h port 9 function register l pf9l 00h fffffc73h port 9 function register h pf9h 00h fffffd00h csib0 control register 0 cb0ctl0 01h fffffd01h csib0 control register 1 cb0ctl1 00h fffffd02h csib0 control register 2 cb0ctl2 00h fffffd03h csib0 status register cb0str r/w 00h fffffd04h csib0 receive data register cb0rx 0000h fffffd04h csib0 receive data register l cb0rxl r 00h fffffd06h csib0 transmit data register cb0tx 0000h fffffd06h csib0 transmit data register l cb0txl 00h fffffd10h csib1 control register 0 cb1ctl0 01h fffffd11h csib1 control register 1 cb1ctl1 00h fffffd12h csib1 control register 2 cb1ctl2 00h fffffd13h csib1 status register cb1str r/w 00h fffffd14h csib1 receive data register cb1rx 0000h fffffd14h csib1 receive data register l cb1rxl r 00h fffffd16h csib1 transmit data register cb1tx 0000h fffffd16h csib1 transmit data register l cb1txl 00h fffffd20h csib2 control register 0 cb2ctl0 01h fffffd21h csib2 control register 1 cb2ctl1 00h fffffd22h csib2 control register 2 cb2ctl2 00h fffffd23h csib2 status register cb2str r/w 00h fffffd24h csib2 receive data register cb2rx 0000h fffffd24h csib2 receive data register l cb2rxl r 00h fffffd26h csib2 transmit data register cb2tx 0000h fffffd26h csib2 transmit data register l cb2txl 00h fffffd30h csib3 control register 0 cb3ctl0 01h fffffd31h csib3 control register 1 cb3ctl1 00h fffffd32h csib3 control register 2 cb3ctl2 00h fffffd33h csib3 status register cb3str r/w 00h fffffd34h csib3 receive data register cb3rx 0000h fffffd34h csib3 receive data register l cb3rxl r 00h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 81 (12/12) manipulatable bits address function register name symbol r/w 1 8 16 default value fffffd36h csib3 transmit data register cb3tx 0000h fffffd36h csib3 transmit data register l cb3txl 00h fffffd40h csib4 control register 0 cb4ctl0 01h fffffd41h csib4 control register 1 cb4ctl1 00h fffffd42h csib4 control register 2 cb4ctl2 00h fffffd43h csib4 status register cb4str r/w 00h fffffd44h csib4 receive data register cb4rx 0000h fffffd44h csib4 receive data register l cb4rxl r 00h fffffd46h csib4 transmit data register cb4tx 0000h fffffd46h csib4 transmit data register l cb4txl 00h fffffd50h csib5 control register 0 cb5ctl0 01h fffffd51h csib5 control register 1 cb5ctl1 00h fffffd52h csib5 control register 2 cb5ctl2 00h fffffd53h csib5 status register cb5str r/w 00h fffffd54h csib5 receive data register cb5rx 0000h fffffd54h csib5 receive data register l cb5rxl r 00h fffffd56h csib5 transmit data register cb5tx 0000h fffffd56h csib5 transmit data register l cb5txl 00h fffffd80h iic shift register 0 iic0 00h fffffd82h iic control register 0 iicc0 00h fffffd83h slave address register 0 sva0 00h fffffd84h iic clock select register 0 iiccl0 00h fffffd85h iic function expansion register 0 iicx0 r/w 00h fffffd86h iic status register 0 iics0 r 00h fffffd8ah iic flag register 0 iicf0 00h fffffd90h iic shift register 1 iic1 00h fffffd92h iic control register 1 iicc1 00h fffffd93h slave address register 1 sva1 00h fffffd94h iic clock select register 1 iiccl1 00h fffffd95h iic function expansion register 1 iicx1 r/w 00h fffffd96h iic status register 1 iics1 r 00h fffffd9ah iic flag register 1 iicf1 00h fffffda0h iic shift register 2 iic2 00h fffffda2h iic control register 2 iicc2 00h fffffda3h slave address register 2 sva2 00h fffffda4h iic clock select register 2 iiccl2 00h fffffda5h iic function expansion register 2 iicx2 r/w 00h fffffda6h iic status register 2 iics2 r 00h fffffdaah iic flag register 2 iicf2 00h ffffffbeh external bus interface mode control register eximc r/w 00h
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 82 3.4.7 special registers special registers are registers that are protected from being written with illegal data due to a program hang-up. the v850es/jj2 has the following eight special registers. ? power save control register (psc) ? clock control register (ckc) ? processor clock control register (pcc) ? clock monitor mode register (clm) ? reset source flag register (resf) ? low-voltage detection register (lvim) ? internal ram data status register (rams) ? on-chip debug mode register (ocdm) in addition, the prcdm register is provided to protect again st a write access to the spec ial registers so that the application system does not inadvertently stop due to a progra m hang-up. a write access to the special registers is made in a specific sequence, and an illegal st ore operation is reported to the sys register.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 83 (1) setting data to special registers set data to the special registers in the following sequence. <1> disable dma operation. <2> prepare data to be set to the special register in a general-purpose register. <3> write the data prepared in <2> to the prcmd register. <4> write the setting data to the special re gister (by using the following instructions). ? store instruction (st/sst instruction) ? bit manipulation instruction (set1/clr1/not1 instruction) (<5> to <9> insert nop instructions (5 instructions).) note <10> enable dma operation if necessary. [example] with psc register (setting standby mode) st.b r11, psmr[r0] ; set psmr register (setting idle1, idle2, and stop modes). <1>clr1 0, dchcn[r0] ; disable dma operation. n = 0 to 3 <2>mov0x02, r10 <3>st.b r10, prcmd[r0] ; write prcmd register. <4>st.b r10, psc[r0] ; set psc register. <5>nop note ; dummy instruction <6>nop note ; dummy instruction <7>nop note ; dummy instruction <8>nop note ; dummy instruction <9>nop note ; dummy instruction <10>set1 0, dchcn[r0] ; enable dma operation. n = 0 to 3 (next instruction) there is no special sequence to read a special register. note five nop instructions or more must be insert ed immediately after setting the idle1 mode, idle2 mode, or stop mode (by setting the psc.stp bit to 1). cautions 1. when a store instruction is executed to store data in the command register, interrupts are not acknowledged. this is because it is assumed that steps <3> and <4> above are performed by successive store instructions. if another instruction is placed between <3> and <4>, and if an interrupt is acknowledged by that instruction, the above sequence may not be established, causing malfunction. 2. although dummy data is written to th e prcmd register, use the same general-purpose register used to set the speci al register (<4> in example) to write data to the prcmd register (<3> in example). the same applies when a general-purpose register is used for addressing.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 84 (2) command register (prcmd) the prcmd register is an 8-bit register that protects the registers that may seriously affect the application system from being written, so that the system does not inadvertently stop due to a program hang-up. the first write access to a special register is valid after data has be en written in advance to the prcmd register. in this way, the value of the special register can be rewritten only in a specific sequence, so as to protect the register from an illegal write access. the prcmd register is write-only, in 8-bit units (undefined data is read when this register is read). 7 reg7 prcmd 6 reg6 5 reg5 4 reg4 3 reg3 2 reg2 1 reg1 0 reg0 after reset: undefined w address: fffff1fch
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 85 (3) system status register (sys) status flags that indicate the ope ration status of the overall system are allocated to this register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 protection error did not occur protection error occurred prerr 0 1 detects protection error sys 0 0 0 0 0 0 prerr after reset: 00h r/w address: fffff802h < > the prerr flag operates under the following conditions. (a) set condition (prerr flag = 1) (i) when data is written to a special register without writing anything to the prcmd register (when <4> is executed without executing <3> in 3.4.7 (1) setting data to special registers ) (ii) when data is written to an on-chip peripheral i/o register other than a special register (including execution of a bit manipulation instruction) afte r writing data to the prcmd register (if <4> in 3.4.7 (1) setting data to special registers is not the setting of a special register) remark even if an on-chip peripheral i/o register is read (except by a bit manipulation instruction) between an operation to write the prcmd register and an operation to write a special register, the prerr flag is not set, and the set dat a can be written to the special register. (b) clear condition (prerr flag = 0) (i) when 0 is written to the prerr flag (ii) when the system is reset cautions 1. if 0 is written to the prerr bit of the sys register, which is not a special register, immediately after a write access to the prcm d register, the prerr bit is cleared to 0 (the write access takes precedence). 2. if data is written to the prcmd regist er, which is not a special register, immediately after a write access to the prcmd regi ster, the prerr bit is set to 1.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 86 3.4.8 cautions (1) registers to be set first be sure to set the following registers first when using the v850es/jj2. ? system wait control register (vswc) ? on-chip debug mode register (ocdm) ? watchdog timer mode register 2 (wdtm2) after setting the vswc, ocdm, and wdtm2 registers, set the other registers as necessary. when using the external bus, set each pin to the alternate-function bus control pin mode by using the port- related registers after setting the above registers. (a) system wait control register (vswc) the vswc register controls wait of bus a ccess to the on-chip peripheral i/o registers. three clocks are required to access an on-chip per ipheral i/o register (without a wait cycle). the v850es/jj2 requires wait cycles according to the operating frequency. set the following value to the vswc register in accordance with the frequency used. the vswc register can be read or written in 8-bit units (address: fffff06eh, default value: 77h). operating frequency (f clk ) set value of vswc number of waits 32 khz f clk < 16.6 mhz 00h 0 (no waits) 16.6 mhz f clk < 20 mhz 01h 1 (b) on-chip debug mode register (ocdm) for details, see chapter 27 on-chip debug function . (c) watchdog timer mode register 2 (wdtm2) the wdtm2 register sets the overflow time a nd the operation clock of watchdog timer 2. watchdog timer 2 automatically starts in the reset mode after reset is released. write the wdtm2 register to activate this operation. for details, refer to chapter 11 functions of watchdog timer 2 .
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 87 (2) accessing specific on-chip peripheral i/o registers this product has two types of internal system buses. one is a cpu bus and the other is a peripheral bus t hat interfaces with low-speed peripheral hardware. the clock of the cpu bus and the cloc k of the peripheral bus are asynchronous. if an access to the cpu and an access to the peripheral hardware conflict, therefore, unexpected illegal data may be transferred. if there is a possibility of a conflict, the number of cycles for acce ssing the cpu changes when t he peripheral hardware is accessed, so that correct data is transferred. as a result, the cpu does not start processing of the next instruction but enters the wait state. if this wait st ate occurs, the number of clocks required to execute an instruction increases by the number of wait clocks shown below. this must be taken into consideration if real-time processing is required. when specific on-chip peripheral i/o r egisters are accessed, more wait stat es may be required in addition to the wait states set by the vswc register. the access conditions and how to calculate the number of wait states to be inserted (number of cpu clocks) at this time are shown below. peripheral function register name access k tpncnt read 1 or 2 write ? 1st access: no wait ? continuous write: 3 or 4 16-bit timer/event counter p (tmp) (n = 0 to 8) tpnccr0, tpnccr1 read 1 or 2 tq0cnt read 1 or 2 write ? 1st access: no wait ? continuous write: 3 or 4 16-bit timer/event counter q (tmq) tq0ccr0 to tq0ccr3 read 1 or 2 watchdog timer 2 (wdt2) wdtm2 write (when wdt2 operating) 3 real-time output function (rto) (n = 0, 1) rtbln, rtbhn write (rtpcn.rtpoen bit = 0) 1 ada0m0 read 1 or 2 ada0cr0 to ada0cr15 read 1 or 2 a/d converter ada0cr0h to ada0cr15h read 1 or 2 i 2 c00 to i 2 c02 iics0 to iics2 read 1 number of clocks necessary for access = 3 + i + j + (2 + j) k caution accessing the above register s is prohibited in the following statuses. if a wait cycle is generated, it can only be cleared by a reset. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock remark i: values (0 or 1) of higher 4 bits of vswc register j: values (0 or 1) of lower 4 bits of vswc register
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 88 (3) system reserved area in the v850es/jj2, 0000007ah to 0000007fh is a system reserved area fo r function expansio n, and therefore it is recommended that this area not be used. 0000007ah 0000007fh 00000080h 00000079h 00000070h 00000000h system reserved area security id note (10 bytes) note for the security id, see 27.6.1 security id . caution when the data in the fl ash memory has been deleted, a ll the bits are cleared to 1.
chapter 3 cpu function preliminary user's manual u17714ej1v0ud 89 (4) restriction on conflict between sld instruction and interrupt request (a) description if a conflict occurs between the decode operation of an instruction in <2> immediately before the sld instruction following an instruction in <1> and an in terrupt request before the instruction in <1> is complete, the execution result of the instru ction in <1> may not be stored in a register. instruction <1> ? ld instruction: ld.b, ld.h, ld.w, ld.bu, ld.hu ? sld instruction: sld.b, sl d.h, sld.w, sld.bu, sld.hu ? multiplication instruction: mul, mulh, mulhi, mulu instruction <2> mov reg1, reg2 satadd reg1, reg2 and reg1, reg2 add reg1, reg2 mulh reg1, reg2 not reg1, reg2 satadd imm5, reg2 tst reg1, reg2 add imm5, reg2 shr imm5, reg2 satsubr reg1, reg2 or reg1, reg2 subr reg1, reg2 cmp reg1, reg2 sar imm5, reg2 satsub reg1, reg2 xor reg1, reg2 sub reg1, reg2 cmp imm5, reg2 shl imm5, reg2 ld.w [r11], r10 if the decode operation of the mov instruction immediately before the sld instruction and an interrupt reques t conflict before execution of the ld instruction is complete, the executio n result of instruction may not be stored in a register. mov r10, r28 sld.w 0x28, r10 (b) countermeasure <1> when compiler (ca850) is used use ca850 ver. 2.61 or later because generation of the corresponding instruction sequence can be automatically suppressed. <2> countermeasure by assembler when executing the sld instruction immediately afte r instruction , avoid the above operation using either of the following methods. ? insert a nop instruction immediat ely before the sld instruction. ? do not use the same register as the sld instructio n destination register in the above instruction executed immediately befor e the sld instruction. ? ? ?
preliminary user's manual u17714ej1v0ud 90 chapter 4 port functions 4.1 features i/o ports: 128 ? 5 v tolerant/n-ch open-drain output switch able: 60 (ports 0, 3 to 6, 8, 9) input/output specifiable in 1-bit units 4.2 basic port configuration the v850es/jj2 features a total of 128 i/o ports consisting of ports 0, 1, 3 to 9, cd, cm, cs, ct, dh, and dl. the port configuration is shown below. figure 4-1. port configuration diagram p00 p06 port 0 pcd0 pcd3 port cd pcm0 pcm5 port cm pcs0 pcs7 pct0 pct7 port cs port ct p90 p915 port 9 pdh0 pdh7 port dh pdl0 pdl15 port dl p30 p39 port 3 port 1 p40 p42 port 4 p50 p55 port 5 p60 p615 p70 p715 p80 p81 port 6 p10 p11 port 7 port 8 caution ports 0, 3 to 6, 8, and 9 are 5 v tolerant. table 4-1. i/o buffer power supplies for pins power supply corresponding pins av ref0 port 7 av ref1 port 1 bv dd ports cd, cm, cs, ct, dh, dl ev dd reset, ports 0, 3 to 6, 8, 9
chapter 4 port functions preliminary user's manual u17714ej1v0ud 91 4.3 port configuration table 4-2. port configuration item configuration control register port n mode register (pmn: n = 0, 1, 3 to 9, cd, cm, cs, ct, dh, dl) port n mode control register (pmcn: n = 0, 3 to 6, 8, 9, cm, cs, ct, dh, dl) port n function control register (pfcn: n = 0, 3 to 6, 9) port n function control expansion register (pfcen: n = 3, 5, 9) port n function register (pfn: n = 0, 3 to 6, 8, 9) ports i/o: 128 (1) port n register (pn) data is input from or output to an external device by writing or reading the pn register. the pn register consists of a port latch that holds output data, and a circ uit that reads the status of pins. each bit of the pn register corresponds to one pin of port n, and can be read or written in 1-bit units. pn7 outputs 0 outputs 1 pnm 0 1 control of output data (in output mode) pn6 pn5 pn4 pn3 pn2 pn1 pn0 0 1 2 3 7 5 6 7 pn after reset: 00h (output latch) r/w data is written to or read from the pn register as follows, regardless of the setting of the pmcn register. table 4-3. writing/reading pn register setting of pmn register writing to pn register reading from pn register output mode (pmnm = 0) data is written to the output latch note . in the port mode (pmcn = 0), the contents of the output latch are output from the pins. the value of the output latch is read. input mode (pmnm = 1) data is written to the output latch. the pin status is not affected note . the pin status is read. note the value written to the output latch is retained until a new value is written to the output latch.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 92 (2) port n mode register (pmn) the pmn register specifies the input or output mode of the corresponding port pin. each bit of this register corresponds to one pin of port n, and the input or output mode can be specified in 1-bit units. pmn7 output mode input mode pmnm 0 1 control of input/output mode pmn6 pmn5 pmn4 pmn3 pmn2 pmn1 pmn0 pmn after reset: ffh r/w (3) port n mode control register (pmcn) the pmcn register specifies the port mode or alternate function. each bit of this register corresponds to one pin of port n, and the mode of the port can be specified in 1-bit units. port mode alternate function mode pmcnm 0 1 specification of operation mode pmcn7 pmcn6 pmcn5 pmcn4 pmcn3 pmcn2 pmcn1 pmcn0 pmcn after reset: 00h r/w
chapter 4 port functions preliminary user's manual u17714ej1v0ud 93 (4) port n function control register (pfcn) the pfcn register specifies the alternat e function of a port pin to be used if the pin has two alternate functions. each bit of this register corresponds to one pin of port n, and the alternate function of a port pin can be specified in 1-bit units. pfcn7 pfcn6 pfcn5 pfcn4 pfcn3 pfcn2 pfcn1 pfcn0 pfcn after reset: 00h r/w alternate function 1 alternate function 2 pfcnm 0 1 specification of alternate function (5) port n function control expansion register (pfcen) the pfcen register specifies the alte rnate function of a port pin to be used if the pin has three or more alternate functions. each bit of this register corresponds to one pin of port n, and the alternate function of a port pin can be specified in 1-bit units. pfcn7 pfcn6 pfcn5 pfcn4 pfcn3 pfcn2 pfcn1 pfcn0 pfcen7 pfcen6 pfcen5 pfcen4 pfcen3 pfcen2 pfcen1 pfcen0 after reset: 00h r/w pfcen pfcn alternate function 1 alternate function 2 alternate function 3 alternate function 4 pfcenm 0 0 1 1 specification of alternate function pfcnm 0 1 0 1
chapter 4 port functions preliminary user's manual u17714ej1v0ud 94 (6) port n function register (pfn) the pfn register specifies normal output or n-ch open-drain output. each bit of this register corresponds to one pin of por t n, and the output mode of the port pin can be specified in 1-bit units. pfn7 pfn6 pfn5 pfn4 pfn3 pfn2 pfn1 pfn0 normal output (cmos output) n-ch open-drain output pfnm note 0 1 control of normal output/n-ch open-drain output pfn after reset: 00h r/w note the pfnm bit of the pfn register is valid only when the pmnm bit of the pmn register is 0 (when the output mode is specified) in port mode (pmcnm bit = 0). when the pmnm bit is 1 (when the input mode is specified), the set value of the pfn register is invalid.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 95 (7) port setting set a port as illustrated below. figure 4-2. setting of each register and pin function pmcn register output mode input mode pmn register ?0? ?1? ?0? ?1? ?0? ?1? (a) (b) (c) (d) alternate function (when two alternate functions are available) port mode alternate function 1 alternate function 2 pfcn register alternate function (when three or more alternate functions are available) alternate function 1 alternate function 2 alternate function 3 alternate function 4 pfcn register pfcen register pfcenm 0 1 0 1 0 0 1 1 (a) (b) (c) (d) pfcnm remark set the alternate functions in the following sequence. <1> set the pfcn and pfcen registers. <2> set the pfcn register. <3> set the intrn or intfn register (to specify an external interrupt pin). if the pmcn register is set first, an unintende d function may be set while the pfcn and pfcen registers are being set.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 96 4.3.1 port 0 port 0 is a 7-bit port for which i/o settings can be controlled in 1-bit units. port 0 includes the following alternate-function pins. table 4-4. port 0 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p00 6 tip61/top61 i/o g-1 p01 7 tip60/top60 i/o g-1 p02 17 nmi input l-1 p03 18 intp0/adtrg input n-1 p04 19 intp1 input l-1 p05 20 intp2/drst note input aa-1 p06 21 intp3 input selectable as n-ch open-drain output l-1 note the drst pin is used for on-chip debugging. if on-chip debugging is not used, fix the p05/intp2/ drst pin to low level between when the reset signal of the reset pin is released and when t he ocdm.ocdm0 bit is cleared (0). for details, see 4.6.3 cautions on on-chip debug pins . caution the p00 to p06 pins have h ysteresis characteristics in the input mode of the alternate function, but do not have hysteresis characteristics in the port mode. (1) port 0 register (p0) 0 outputs 0 outputs 1 p0n 0 1 output data control (in output mode) (n = 0 to 6) p0 p06 p05 p04 p03 p02 p01 p00 after reset: 00h (output latch) r/w address: fffff400h (2) port 0 mode register (pm0) 1 output mode input mode pm0n 0 1 i/o mode control (n = 0 to 6) pm0 pm06 pm05 pm04 pm03 pm02 pm01 pm00 after reset: ffh r/w address: fffff420h
chapter 4 port functions preliminary user's manual u17714ej1v0ud 97 (3) port 0 mode control register (pmc0) 0 pmc0 pmc06 pmc05 pmc04 pmc03 pmc02 pmc01 pmc00 i/o port intp3 input pmc06 0 1 specification of p06 pin operation mode i/o port intp2 input pmc05 0 1 specification of p05 pin operation mode i/o port intp1 input pmc04 0 1 specification of p04 pin operation mode i/o port intp0 input/adtrg input pmc03 0 1 specification of p03 pin operation mode i/o port nmi input pmc02 0 1 specification of p02 pin operation mode after reset: 00h r/w address: fffff440h i/o port tip60 input/top60 output pmc01 0 1 specification of p01 pin operation mode i/o port tip61 input/top61 output pmc00 0 1 specification of p00 pin operation mode caution the p05/intp2/drst pin becomes the drst pin regardless of the value of the pmc05 bit when the ocdm.ocdm0 bit = 1.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 98 (4) port 0 function control register (pfc0) pfc0 after reset: 00h r/w address: fffff460h 0 0 0 0 pfc03 0 pfc01 pfc00 intp0 input adtrg input pfc03 0 1 specification of p03 pin alternate function tip60 input top60 output pfc01 0 1 specification of p01 pin alternate function tip61 input top61 output pfc00 0 1 specification of p00 pin alternate function (5) port 0 function register (pf0) 0 normal output (cmos output) n-ch open drain output pf0n 0 1 control of normal output or n-ch open-drain output (n = 0 to 6) pf0 pf06 pf05 pf04 pf03 pf02 pf01 pf00 after reset: 00h r/w address: fffffc60h caution when an output pin is pulled up at ev dd or higher, be sure to set the pf0n bit to 1.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 99 4.3.2 port 1 port 1 is a 2-bit port for which i/o settings can be controlled in 1-bit units. port 1 includes the following alternate-function pins. table 4-5. port 1 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p10 3 ano0 output ? a-2 p11 4 ano1 output ? a-2 caution when the power is turned on, the p10 and p11 pins may output an undefined level temporarily, even during reset. (1) port 1 register (p1) 0 outputs 0 outputs 1 p1n 0 1 output data control (in output mode) (n = 0, 1) p1 0 0 0 0 0 p11 p10 after reset: 00h (output latch) r/w address: fffff402h caution do not read or write the p1 register during d/a conversion (see 14.4.3 cautions). (2) port 1 mode register (pm1) 1 output mode input mode pm1n 0 1 i/o mode control (n = 0, 1) pm1 1 1 1 1 1 pm11 pm10 after reset: ffh r/w address: fffff422h cautions 1. when using p1n as alternate functions (anon pin output), set the pm1n bit to 1. 2. when using one of the p10 and p11 pins as an i/o port and the other as a d/a output pin, do so in an appl ication where the port i/o le vel does not change during d/a output.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 100 4.3.3 port 3 port 3 is a 10-bit port for which i/o settings can be controlled in 1-bit units. port 3 includes the following alternate-function pins. table 4-6. port 3 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p30 25 txda0/sob4 output g-3 p31 26 rxda0/intp7/sib4 input n-3 p32 27 ascka0/sckb4/tip00/top00 i/o u-1 p33 28 tip01/top01 i/o g-1 p34 29 tip10/top10 i/o g-1 p35 30 tip11/top11 i/o g-1 p36 31 ? output c-1 p37 32 ? input c-1 p38 35 txda2/sda00 i/o g-12 p39 36 rxda2/scl00 i/o selectable as n-ch open-drain output g-6 caution the p31 to p35, p38, and p39 pins have h ysteresis characteristics in the input mode of the alternate-function pin, but do not have the h ysteresis characteristics in the port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 101 (1) port 3 register (p3) outputs 0 outputs 1 p3n 0 1 output data control (in output mode) (n = 0 to 9) p3 (p3h) after reset: 0000h (output latch) r/w address: p3 fffff406h, p3l fffff406h, p3h fffff407h 0 0 0 0 0 0 p39 p38 p37 p36 p35 p34 p33 p32 p31 p30 8 9 10 11 12 13 14 15 (p3l) remarks 1. the p3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p3 register as the p3h register and the lower 8 bits as the p3l register, p3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p3 register in 8- bit or 1-bit units, specify them as bits 0 to 7 of the p3h register. (2) port 3 mode register (pm3) 1 output mode input mode pm3n 0 1 i/o mode control (n = 0 to 9) 1 1 1 1 1 pm39 pm38 pm37 pm36 pm35 pm34 pm33 pm32 pm31 pm30 after reset: ffffh r/w address: pm3 fffff426h, pm3l fffff426h, pm3h fffff427h 8 9 10 11 12 13 14 15 pm3 (pm3h) (pm3l) remarks 1. the pm3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm3 register as the pm3h register and the lower 8 bits as the pm3l register, pm3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pm3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm3h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 102 (3) port 3 mode control register (pmc3) i/o port rxda2 input/scl00 i/o pmc39 0 1 specification of p39 pin operation mode i/o port txda2 output/sda00 i/o pmc38 0 1 specification of p38 pin operation mode after reset: 0000h r/w address: pmc3 fffff446h, pmc3l fffff446h, pmc3h fffff447h 0 0 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pmc3 (pmc3h) (pmc3l) i/o port tip11 input/top11 output pmc35 0 1 specification of p35 pin operation mode i/o port tip10 input/top10 output/crxd1 input pmc34 0 1 specification of p34 pin operation mode i/o port tip01 input/top01 output/ctxd1 output pmc33 0 1 specification of p33 pin operation mode i/o port ascka0 input/sckb4 i/o/tip00 input/top00 output pmc32 0 1 specification of p32 pin operation mode i/o port rxda0 input/sib4 input/intp7 input pmc31 0 1 specification of p31 pin operation mode i/o port txda0 output/sob4 output pmc30 0 1 specification of p30 pin operation mode caution be sure to clear bits 15 to 10, 7, and 6 to ?0?. remarks 1. the pmc3 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc3 register as the pmc3h register and the lower 8 bits as the pmc3l register, pmc3 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc3h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 103 (4) port 3 function control register (pfc3) after reset: 0000h r/w address: pfc3 fffff466h, pfc3l fffff466h, pfc3l fffff467h 0 0 0 0 0 0 pfc39 pfc38 0 0 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfc3 (pfc3h) (pfc3l) remarks 1. for details of alternate function specification, see 4.3.3 (6) port 3 alternate function specifications . 2. the pfc3 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pfc3 register as the pfc3h register and the lower 8 bits as the pfc3l register, pfc3 ca n be read or written in 8-bit and 1-bit units. 3. to read/write bits 8 to 15 of the pfc3 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfc3h register. (5) port 3 function control ex pansion register l (pfce3l) pfce3l after reset: 00h r/w address: fffff706h 0 0 0 0 0 pfce32 0 0 caution be sure to clear bits 7 to 3, 1, and 0 to ?0?. remark for details of alternate function specification, see 4.3.3 (6) port 3 alternate function specifications .
chapter 4 port functions preliminary user's manual u17714ej1v0ud 104 (6) port 3 alternate function specifications pfc39 specification of p39 pin alternate function 0 rxda2 input 1 scl00 input pfc38 specification of p38 pin alternate function 0 txda2 output 1 sda00 i/o pfc35 specification of p35 pin alternate function 0 tip11 input 1 top11 output pfc34 specification of p34 pin alternate function 0 tip10 input 1 top10 output pfc33 specification of p33 pin alternate function 0 tip01 input 1 top01 output pfce32 pfc32 specification of p32 pin alternate function 0 0 ascka0 input 0 1 sckb4 i/o 1 0 tip00 input 1 1 top00 output pfc31 specification of p31 pin alternate function 0 rxda0 input/intp7 note input 1 sib4 input pfc30 specification of p30 pin alternate function 0 txda0 output 1 sob4 output note the intp7 pin and rxda0 pin are alternate-function pins. when using the pin as the rxda0 pin, disable edge detection for the intp7 alternate-function pin. (clear the intf3.intf31 bit and the intr3.intr31 bit to 0.) when using the pin as the intp7 pin, stop uarta0 reception. (clear the ua0ctl0.ua0rxe bit to 0.)
chapter 4 port functions preliminary user's manual u17714ej1v0ud 105 (7) port 3 function register (pf3) after reset: 0000h r/w address: pf3 fffffc66h, pf3l fffffc66h, pf3h fffffc67h pf37 pf36 pf35 pf34 pf33 pf32 pf31 pf30 0 0 0 0 0 0 pf39 pf38 8 9 10 11 12 13 14 15 normal output (cmos output) n-ch open-drain output pf3n 0 1 control of normal output or n-ch open-drain output (n = 0 to 9) pf3 (pf3h) (pf3l) caution when an output pin is pulled up at ev dd or higher, be sure to set the pf3n bit to 1. remarks 1. the pf3 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf 3 register as the pf3h register and the lower 8 bits as the pf3l register, pf3 can be re ad or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pf3 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf3h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 106 4.3.4 port 4 port 4 is a 3-bit port that controls i/o in 1-bit units. port 4 includes the following alternate-function pins. table 4-7. port 4 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p40 22 sib0/sda01 i/o g-6 p41 23 sob0/scl01 i/o g-12 p42 24 sckb0 i/o selectable as n-ch open-drain output e-3 caution the p40 to p42 pins have hysteresis characteri stics in the input mode of the alternate-function pin, but do not have the hysteresis characteristics in the port mode. (1) port 4 register (p4) 0 outputs 0 outputs 1 p4n 0 1 output data control (in output mode) (n = 0 to 2) p4 0 0 0 0 p42 p41 p40 after reset: 00h (output latch) r/w address: fffff408h (2) port 4 mode register (pm4) 1 output mode input mode pm4n 0 1 i/o mode control (n = 0 to 2) pm4 1 1 1 1 pm42 pm41 pm40 after reset: ffh r/w address: fffff428h
chapter 4 port functions preliminary user's manual u17714ej1v0ud 107 (3) port 4 mode control register (pmc4) 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 i/o port sckb0 i/o pmc42 0 1 specification of p42 pin operation mode i/o port sob0 output/scl01 i/o pmc41 0 1 specification of p41 pin operation mode i/o port sib0 input/sda01 i/o pmc40 0 1 specification of p40 pin operation mode after reset: 00h r/w address: fffff448h (4) port 4 function control register (pfc4) pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 sob0 output scl01 i/o pfc41 0 1 specification of p41 pin alternate function sib0 input sda01 i/o pfc40 0 1 specification of p40 pin alternate function (5) port 4 function register (pf4) 0 normal output (cmos output) n-ch open-drain output pf4n 0 1 control of normal output or n-ch open-drain output (n = 0 to 2) pf4 0 0 0 0 pf42 pf41 pf40 after reset: 00h r/w address: fffffc68h caution when an output pin is pulled up at ev dd or higher, be sure to set the pf4n bit to 1.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 108 4.3.5 port 5 port 5 is a 6-bit port that controls i/o in 1-bit units. port 5 includes the following alternate-function pins. table 4-8. port 5 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p50 37 tiq01/kr0/toq01/rtp00 i/o u-5 p51 38 tiq02/kr1/toq02/rtp01 i/o u-5 p52 39 tiq03/kr2/toq03/rtp02/ddi note i/o u-6 p53 40 sib2/kr3/tiq00/toq00/rtp03/ddo note i/o u-7 p54 41 sob2/kr4/rtp04/dck note i/o u-8 p55 42 sckb2/kr5/rtp05/dms note i/o selectable as n-ch open-drain output u-9 note the ddi, ddo, dck, and dms pins are used for on-chip debugging. if on-chip debugging is not used, fix the p05/intp2/drs t pin to low level between when the reset signal of the reset pin is released and when the ocdm.ocdm0 bit is cleared (0). for details, see 4.6.3 cautions on on-chip debug pins . cautions 1. when the power is turn ed on, the p53 pin may output undefined level temporarily, even during reset. 2. the p50 to p55 pins have hysteresis charact eristics in the input mode of the alternate function, but do not have hysteresis characteristics in the port mode. (1) port 5 register (p5) 0 outputs 0 outputs 1 p5n 0 1 output data control (in output mode) (n = 0 to 5) p5 0 p55 p54 p53 p52 p51 p50 after reset: 00h (output latch) r/w address: fffff40ah (2) port 5 mode register (pm5) 1 output mode input mode pm5n 0 1 i/o mode control (n = 0 to 5) pm5 1 pm55 pm54 pm53 pm52 pm51 pm50 after reset: ffh r/w address: fffff42ah
chapter 4 port functions preliminary user's manual u17714ej1v0ud 109 (3) port 5 mode control register (pmc5) 0 pmc5 0 pmc55 pmc54 pmc53 pmc52 pmc51 pmc50 i/o port sckb2 i/o/kr5 input/rtp05 output pmc55 0 1 specification of p55 pin operation mode i/o port sob2 output/kr4 input/rtp04 output pmc54 0 1 specification of p54 pin operation mode i/o port sib2 input/kr3 input/tiq00 input/toq00 output/rtp03 output pmc53 0 1 specification of p53 pin operation mode i/o port tiq03 input/kr2 input/toq03 output/rtp02 output pmc52 0 1 specification of p52 pin operation mode i/o port tiq02 input/kr1 input/toq02 output/rtp01 output pmc51 0 1 specification of p51 pin operation mode i/o port tiq01 input/kr0 input/toq01 output/rtp00 output pmc50 0 1 specification of p50 pin operation mode after reset: 00h r/w address: fffff44ah (4) port 5 function control register (pfc5) 0 pfc5 0 pfc55 pfc54 pfc53 pfc52 pfc51 pfc50 after reset: 00h r/w address: fffff46ah remark for details of alternate function specification, see 4.3.5 (6) port 5 alternate function specifications .
chapter 4 port functions preliminary user's manual u17714ej1v0ud 110 (5) port 5 function control expansion register (pfce5) 0 pfce5 0 pfce55 pfce54 pfce53 pfce52 pfce51 pfce50 after reset: 00h r/w address: fffff70ah remark for details of alternate function specification, see 4.3.5 (6) port 5 alternate function specifications . (6) port 5 alternate function specifications pfce55 pfc55 specification of p55 pin alternate function 0 0 sckb2 i/o 0 1 kr5 input 1 0 setting prohibited 1 1 rtp05 output pfce54 pfc54 specification of p54 pin alternate function 0 0 sob2 output 0 1 kr4 input 1 0 setting prohibited 1 1 rtp04 output pfce53 pfc53 specification of p53 pin alternate function 0 0 sib2 input 0 1 tiq00 input/kr3 note input 1 0 toq00 output 1 1 rtp03 output pfce52 pfc52 specification of p52 pin alternate function 0 0 setting prohibited 0 1 tiq03 input/kr2 note input 1 0 toq03 input 1 1 rtp02 output pfce51 pfc51 specification of p51 pin alternate function 0 0 setting prohibited 0 1 tiq02 input/kr1 note input 1 0 toq02 output 1 1 rtp01 output
chapter 4 port functions preliminary user's manual u17714ej1v0ud 111 pfce50 pfc50 specification of p50 pin alternate function 0 0 setting prohibited 0 1 tiq01 input/kr0 note input 1 0 toq01 output 1 1 rtp00 output note the krn pin and tiq0m pin are alternate-function pins. when using the pin as the tiq0m pin, disable krn pin key return detection, which is the al ternate function. (clear the krm.krmn bit to 0.) also, when using the pin as the krn pin, disable tiq0m pin edge detection, which is the alternate function (n = 0 to 3, m = 0 to 3). pin name use as tiq0m pin use as krn pin kr0/tiq01 krm.krm0 bit = 0 tq0ioc1. tq0tig2, tq0ioc1. tq0tig3 bits = 0 kr1/tiq02 krm.krm1 bit = 0 tq0ioc1.tq0tig4, tq0ioc1.tq0tig5 bits = 0 kr2/tiq03 krm.krm2 bit = 0 tq0ioc1.tq0tig6, tq0ioc1.tq0tig7 bits = 0 kr3/tiq00 krm.krm3 bit = 0 tq0ioc1.tq0tig0, tq0ioc1.tq0tig1 bits = 0 tq0ioc2.tq0ees0, tq0ioc2.tq0ees1 bits = 0 tq0ioc2.tq0ets0, tq0ioc2.tq0ets1 bits = 0 (7) port 5 function register (pf5) 0 normal output (cmos output) n-ch open-drain output pf5n 0 1 control of normal output or n-ch open-drain output (n = 0 to 5) pf5 0 pf55 pf54 pf53 pf52 pf51 pf50 after reset: 00h r/w address: fffffc6ah caution when an output pin is pulled up at ev dd or higher, be sure to set the pf5n bit to 1.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 112 4.3.6 port 6 port 6 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 6 includes the following alternate-function pins. table 4-9. port 6 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p60 43 rtp10 output e-2 p61 44 rtp11 output e-2 p62 45 rtp12 output e-2 p63 46 rtp13 output e-2 p64 47 rtp14 output e-2 p65 48 rtp15 output e-2 p66 49 sib5 input e-1 p67 50 sob5 output e-2 p68 51 sckb5 i/o e-3 p69 52 tip70/top70 i/o g-1 p610 53 tip71 input e-1 p611 54 top71 output e-2 p612 55 tip80/top80 i/o g-1 p613 56 tip81/top81 i/o g-1 p614 57 ? ? c-1 p615 58 ? ? selectable as n-ch open-drain output c-1 caution the p66, p68 to p610, p612, and p613 pins have hysteresis ch aracteristics in the input mode of the alternate-function pin, but do not have th e hysteresis characteristics in the port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 113 (1) port 6 register (p6) p615 outputs 0 outputs 1 p6n 0 1 output data control (in output mode) (n = 0 to 15) p6 (p6h) (p6l) p614 p613 p612 p611 p610 p69 p68 after reset: 0000h (output latch) r/w address: p6 fffff40ch p6l fffff40ch, p6lh fffff40dh p67 p66 p65 p64 p63 p62 p61 p60 8 9 10 11 12 13 14 15 remarks 1. the p6 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p6 register as the p6h register and the lower 8 bits as the p6l register, p6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p6 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the p6h register. (2) port 6 mode register (pm6) pm67 output mode input mode pm6n 0 1 i/o mode control (n = 0 to 15) pm66 pm65 pm64 pm63 pm62 pm61 pm60 after reset: ffffh r/w address: pm6 fffff42ch pm6l fffff42ch, pm6h fffff42dh pm615 pm6 (pm6h) (pm6l) pm614 pm613 pm612 pm611 pm610 pm69 pm68 8 9 10 11 12 13 14 15 remarks 1. the pm6 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm6 register as the pm6h register and the lower 8 bits as the pm6l register, pm6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pm6 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm6h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 114 (3) port 6 mode control register (pmc6) i/o port tip81 input/top81 output pmc613 0 1 specification of p613 pin operation mode pmc67 pmc66 pmc65 pmc64 pmc63 pmc62 pmc61 pmc60 after reset: 0000h r/w address: pmc6 fffff44ch pmc6l fffff44ch, pmc6h fffff44dh 0 pmc6 (pmc6h) (pmc6l) 0 pmc613 pmc612 pmc611 pmc610 pmc69 pmc68 8 9 10 11 12 13 14 15 i/o port tip80 input/top80 output pmc612 0 1 specification of p612 pin operation mode i/o port tip70 input/top70 output pmc69 0 1 specification of p69 pin operation mode i/o port sckb5 i/o pmc68 0 1 specification of p68 pin operation mode i/o port sob5 output pmc67 0 1 specification of p67 pin operation mode i/o port top71 output pmc611 0 1 specification of p611 pin operation mode i/o port tip71 input pmc610 0 1 specification of p610 pin operation mode i/o port sib5 input pmc66 0 1 specification of p66 pin operation mode i/o port rtp1m i/o pmc6m 0 1 specification of p6m pin operation mode (m = 0 to 5) remarks 1. the pmc6 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc6 register as the pmc6h register and the lower 8 bits as the pmc6l register, pmc6 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc6 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc6h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 115 (4) port 6 function control register h (pfc6h) pfc6h after reset: 00h r/w address: fffff46dh 0 0 pfc613 pfc612 0 0 pfc69 0 15 14 13 12 11 10 9 8 tip81 input top81 output pfc613 0 1 specification of p613 pin alternate function tip80 input top80 output pfc612 0 1 specification of p612 pin alternate function tip70 input top70 output pfc69 0 1 specification of p69 pin alternate function (5) port 6 function register (pf6) pf6 (pf6h) (pf6l) after reset: 0000h r/w address: pf6 fffffc6ch pf6l fffffc6ch, pf6h fffffc6dh pf67 pf66 pf65 pf64 pf63 pf62 pf61 pf60 pf615 pf614 pf613 pf612 pf611 pf610 pf69 pf68 8 9 10 11 12 13 14 15 normal output (cmos output) n-ch open-drain output pf6n 0 1 normal output/n-ch open-drain output control (n = 0 to 15) caution when an output pin is pulled up at ev dd or higher, be sure to set the pf6n bit to 1. remarks 1. the pf6 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf6 register as the pf6h register and the lower 8 bits as the pf6l register, pf6 can be re ad or written in 8-bit and 1-bit units. 2. to read/write bits 8 to 15 of the pf6 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf6h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 116 4.3.7 port 7 port 7 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 7 includes the following alternate-function pins. table 4-10. port 7 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p70 144 ani0 input a-1 p71 143 ani1 input a-1 p72 142 ani2 input a-1 p73 141 ani3 input a-1 p74 140 ani4 input a-1 p77 139 ani5 input a-1 p76 138 ani6 input a-1 p77 137 ani7 input a-1 p78 136 ani8 input a-1 p79 135 ani9 input a-1 p710 134 ani10 input a-1 p711 133 ani11 input a-1 p712 132 ani12 input a-1 p713 131 ani13 input a-1 p714 130 ani14 input a-1 p715 129 ani15 input ? a-1
chapter 4 port functions preliminary user's manual u17714ej1v0ud 117 (1) port 7 register h, port 7 register l (p7h, p7l) outputs 0 outputs 1 p7n 0 1 output data control (in output mode) (n = 0 to 15) p7h p7l after reset: 00h (output latch) r/w address: p7l fffff40eh, p7h fffff40fh p77 p76 p75 p74 p73 p72 p71 p70 p715 p714 p713 p712 p711 p710 p79 p78 caution do not read or write the p7h and p7 l registers during a/d conversion (see 13.6 (4) alternate i/o). remark these registers cannot be accessed in 16-bit units as the p7 register. they can be read or written in 8-bit or 1-bit units as the p7h and p7l registers. (2) port 7 mode register h, port 7 mode register l (pm7h, pm7l) pm715 output mode input mode pm7n 0 1 i/o mode control (n = 0 to 15) pm7h pm7l pm714 pm713 pm712 pm711 pm710 pm79 pm78 pm77 pm76 pm75 pm74 pm73 pm72 pm71 pm70 after reset: ffh r/w address: pm7l fffff42eh, pm7h fffff42fh caution when using the p7n pin as its alternate function (anin pin), set the pm7n bit to 1. remark these registers cannot be accessed in 16-bit units as the pm7 register. they can be read or written in 8-bit or 1-bit units as the pm7h and pm7l registers.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 118 4.3.8 port 8 port 8 is a 2-bit port for which i/o settings can be controlled in 1-bit units. port 8 includes the following alternate-function pins. table 4-11. port 8 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p80 59 rxda3/intp8 input l-2 p81 60 txda3 output selectable as n-ch open-drain output e-2 caution the p80 pin has hysteresis characteristics in the input mode of the alternate-function pin, but does not have the hysteresis characteristics in the port mode. (1) port 8 register (p8) 0 outputs 0 outputs 1 p8n 0 1 output data control (n = 0, 1) p8 0 0 0 0 0 p81 p80 after reset: 00h (output latch) r/w address: fffff410h (2) port 8 mode register (pm8) 1 output mode input mode pm8n 0 1 i/o mode control (n = 0, 1) pm8 1 1 1 1 1 pm81 pm80 after reset: ffh r/w address: fffff430h
chapter 4 port functions preliminary user's manual u17714ej1v0ud 119 (3) port 8 mode control register (pmc8) 0 pmc8 0 0 0 0 0 pmc81 pmc80 i/o port txda3 output pmc81 0 1 specification of p81 pin operation mode i/o port rxda3 input/intp8 note input pmc80 0 1 specification of p80 pin operation mode after reset: 00h r/w address: fffff450h note the intp8 and rxda3 pins are alternate-func tion pins. when using the rxda3 pin, disable detection of the edge of the intp8 pin (intf8.intf80 bit = 0 and intr8.intr80 bit = 0). when using the intp8 pin, stop the reception oper ation of uarta3 (ua3ctl0.ua3rxe bit = 0). (4) port 8 function register (pf8) 0 normal output (cmos output) n-ch open-drain output pf8n 0 1 control of normal output or n-ch open-drain output (n = 0, 1) pf8 0 0 0 0 0 pf81 pf80 after reset: 00h r/w address: fffffc70h caution when an output pin is pulled up at ev dd or higher, be sure to set the pf8n bit to 1.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 120 4.3.9 port 9 port 9 is a 16-bit port for which i/o settings can be controlled in 1-bit units. port 9 includes the following alternate-function pins. table 4-12. port 9 alternate-function pins pin name pin no. alternate-function pin name i/o remark block type p90 61 a0/kr6/txda1/sda02 i/o u-10 p91 62 a1/kr7/rxda1/scl02 i/o u-11 p92 63 a2/tip41/top41 i/o u-12 p93 64 a3/tip40/top40 i/o u-12 p94 65 a4/tip31/top31 i/o u-12 p95 66 a5/tip30/top30 i/o u-12 p96 67 a6/tip21/top21 i/o u-13 p97 68 a7/sib1/tip20/top20 i/o u-14 p98 69 a8/sob1 output g-3 p99 70 a9/sckb1 i/o g-5 p910 71 a10/sib3 i/o g-2 p911 72 a11/sob3 output g-3 p912 73 a12/sckb3 i/o g-5 p913 74 a13/intp4 i/o n-2 p914 75 a14/intp5/tip51/top51 i/o u-15 p915 76 a15/intp6/tip50/top50 i/o selectable as n-ch open-drain output u-15 caution the p90 to p97, p99, p910, and p912 to p 915 pins have hysteresis char acteristics in the input mode of the alternate-function pin, but do not ha ve the hysteresis characteristics in the port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 121 (1) port 9 register (p9) p915 outputs 0 outputs 1 p9n 0 1 output data control (in output mode) (n = 0 to 15) p914 p913 p912 p911 p910 p99 p98 after reset: 0000h (output latch) r/w address: p9 fffff412h, p9l fffff412h, p9h fffff413h p97 p96 p95 p94 p93 p92 p91 p90 8 9 10 11 12 13 14 15 p9 (p9h) (p9l) remarks 1. the p9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he p9 register as the p9h register and the lower 8 bits as the p9l register, p9 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the p9 register in 8- bit or 1-bit units, specify them as bits 0 to 7 of the p9h register. (2) port 9 mode register (pm9) pm97 output mode input mode pm9n 0 1 i/o mode control (n = 0 to 15) pm96 pm95 pm94 pm93 pm92 pm91 pm90 after reset: ffffh r/w address: pm9 fffff432h, pm9l fffff432h, pm9h fffff433h pm915 pm914 pm913 pm912 pm911 pm910 pm99 pm98 8 9 10 11 12 13 14 15 pm9 (pm9h) (pm9l) remarks 1. the pm9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pm9 register as the pm9h register and the lower 8 bits as the pm9l register, pm9 can be read or written in 8-bit and 1-bit units. 2. to read/write bits 8 to 15 of the pm9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pm9h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 122 (3) port 9 mode control register (pmc9) (1/2) i/o port a15 output/intp6 input/tip50 input/top50 output pmc915 0 1 specification of p915 pin operation mode pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 after reset: 0000h r/w address: pmc9 fffff452h, pmc9l fffff452h, pmc9h fffff453h pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 i/o port a14 output/intp5 input/tip51 input/top51 output pmc914 0 1 specification of p914 pin operation mode i/o port a11 output/sob3 output pmc911 0 1 specification of p911 pin operation mode i/o port a10 output/sib3 input pmc910 0 1 specification of p910 pin operation mode i/o port a9 output/sckb1 i/o pmc99 0 1 specification of p99 pin operation mode i/o port a13 output/intp4 input pmc913 0 1 specification of p913 pin operation mode i/o port a12 output/sckb3 i/o pmc912 0 1 specification of p912 pin operation mode 8 9 10 11 12 13 14 15 pmc9 (pmc9h) (pmc9l) i/o port a8 output/sob1 output pmc98 0 1 specification of p98 pin operation mode remarks 1. the pmc9 register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmc9 register as the pmc9h register and the lower 8 bits as the pmc9l register, pmc9 can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmc9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmc9h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 123 (2/2) i/o port a7 output/sib1 input/tip20 input/top20 output pmc97 0 1 specification of p97 pin operation mode i/o port a6 output/tip21 input/top21 output pmc96 0 1 specification of p96 pin operation mode i/o port a5 output/tip30 input/top30 output pmc95 0 1 specification of p95 pin operation mode i/o port a4 output/tip31 input/top31 output pmc94 0 1 specification of p94 pin operation mode i/o port a3 output/tip40 input/top40 output pmc93 0 1 specification of p93 pin operation mode i/o port a2 output/tip41 input/top41 output pmc92 0 1 specification of p92 pin operation mode i/o port a1 output/kr7 input/rxda1 input/scl02 i/o pmc91 0 1 specification of p91 pin operation mode i/o port a0 output/kr6 input/txda1 output/sda02 i/o pmc90 0 1 specification of p90 pin operation mode caution only when using the a0 to a15 pins as the alternate functi ons of the p90 to p915 pins, set all 16 bits of the pmc9 register to ffffh at once.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 124 (4) port 9 function control register (pfc9) caution when performing separate address bus output (a0 to a 15), set the pmc9 register to ffffh for all 16 bits at once after clearing the pfc9 register to 0000h. after reset: 0000h r/w address: pfc9 fffff472h, pfc9l fffff472h, pfc9h fffff473h pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 8 9 10 11 12 13 14 15 pfc9 (pfc9h) (pfc9l) remarks 1. for details of alternate function specification, see 4.3.9 (6) port 9 alternate function specifications . 2. the pfc9 register can be read or written in 16-bit units. however, when using the higher 8 bits of t he pfc9 register as the pfc9h register and the lower 8 bits as the pfc9l register, pfc9 ca n be read or written in 8-bit or 1-bit units. 3. to read/write bits 8 to 15 of the pfc9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfc9h register. (5) port 9 function control expansion register (pfce9) after reset: 0000h r/w address: pfce9 fffff712h, pfce9l fffff712h, pfce9h fffff713h pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 pfce915 pfce914 0 0 0 0 0 0 8 9 10 11 12 13 14 15 pfce9 (pfce9h) (pfce9l) remarks 1. for details of alternate function specification, see 4.3.9 (6) port 9 alternate function specifications . 2. the pfce9 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pfce9 register as the pf ce9h register and the lower 8 bits as the pfce9l register, pfce9 can be read or written in 8-bit or 1-bit units. 3. to read/write bits 8 to 15 of the pfce9 register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pfce9h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 125 (6) port 9 alternate function specifications pfce915 pfc915 specification of p915 pin alternate function 0 0 a15 output 0 1 intp6 input 1 0 tip50 input 1 1 top50 output pfce914 pfc914 specification of p914 pin alternate function 0 0 a14 output 0 1 intp5 input 1 0 tip51 input 1 1 top51 output pfc913 specification of p913 pin alternate function 0 a13 output 1 intp4 input pfc912 specification of p912 pin alternate function 0 a12 output 1 sckb3 i/o pfc911 specification of p911 pin alternate function 0 a11 output 1 sob3 output pfc910 specification of p910 pin alternate function 0 a10 output 1 sib3 input pfc99 specification of p99 pin alternate function 0 a9 output 1 sckb1 i/o pfc98 specification of p98 pin alternate function 0 a8 output 1 sob1 output pfce97 pfc97 specification of p97 pin alternate function 0 0 a7 output 0 1 sib1 input 1 0 tip20 input 1 1 top20 output
chapter 4 port functions preliminary user's manual u17714ej1v0ud 126 pfce96 pfc96 specification of p96 pin alternate function 0 0 a6 output 0 1 setting prohibited 1 0 tip21 input 1 1 top21 output pfce95 pfc95 specification of p95 pin alternate function 0 0 a5 output 0 1 tip30 input 1 0 top30 output 1 1 setting prohibited pfce94 pfc94 specification of p94 pin alternate function 0 0 a4 output 0 1 tip31 input 1 0 top31 output 1 1 setting prohibited pfce93 pfc93 specification of p93 pin alternate function 0 0 a3 output 0 1 tip40 input 1 0 top40 output 1 1 setting prohibited pfce92 pfc92 specification of p92 pin alternate function 0 0 a2 output 0 1 tip41 input 1 0 top41 output 1 1 setting prohibited pfce91 pfc91 specification of p91 pin alternate function 0 0 a1 output 0 1 kr7 input 1 0 rxda1 input/kr7 input note 1 1 scl02 i/o pfce90 pfc90 specification of p90 pin alternate function 0 0 a0 output 0 1 kr6 input 1 0 txda1 output 1 1 sda02 i/o note the rxda1 and kr7 pins must not be used at the same time. when using the rxda1 pin, do not use the kr7 pin. when using the kr7 pin, do not use the rx da1 pin (it is recommended to set the pfc91 bit to 1 and clear the pfce91 bit to 0).
chapter 4 port functions preliminary user's manual u17714ej1v0ud 127 (7) port 9 function register (pf9) after reset: 0000h r/w address: pf3 fffffc72h, pf9l fffffc72h, pf9h fffffc73h pf97 pf96 pf95 pf94 pf93 pf92 pf91 pf90 pf915 pf914 pf913 pf912 pf911 pf910 pf99 pf98 normal output (cmos output) n-ch open-drain output pf9n 0 1 control of normal output or n-ch open-drain output (n = 0 to 15) 8 9 10 11 12 13 14 15 pf9 (pf9h) (pf9l) caution when an output pin is pulled up at ev dd or higher, be sure to set the pf9n bit to 1. remarks 1. the pf9 register can be read or written in 16-bit units. however, when using the higher 8 bits of the pf 9 register as the pf9h register and the lower 8 bits as the pf9l register, pf9 can be re ad or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pf9 register in 8-bit or 1-bit uni ts, specify them as bits 0 to 7 of the pf9h register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 128 4.3.10 port cd port cd is a 4-bit port for which i/o setti ngs can be controlled in 1-bit units. port cd includes the following alternate-function pins. table 4-13. port cd alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcd0 77 ? ? b-1 pcd1 78 ? ? b-1 pcd2 79 ? ? b-1 pcd3 80 ? ? ? b-1 (1) port cd register (pcd) 0 outputs 0 outputs 1 pcdn 0 1 output data control (in output mode) (n = 0 to 3) pcd 0 0 0 pcd3 pcd2 pcd1 pcd0 after reset: 00h (output latch) r/w address: fffff00eh (2) port cd mode register (pmcd) 1 output mode input mode pmcdn 0 1 i/o mode control (n = 0 to 3) pmcd 1 1 1 pmcd3 pmcd2 pmcd1 pmcd0 after reset: ffh r/w address: fffff02eh
chapter 4 port functions preliminary user's manual u17714ej1v0ud 129 4.3.11 port cm port cm is a 6-bit port for which i/o setti ngs can be controlled in 1-bit units. port cm includes the following alternate-function pins. table 4-14. port cm alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcm0 85 wait input d-1 pcm1 86 clkout output d-2 pcm2 87 hldak output d-2 pcm3 88 hldrq input d-1 pcm4 89 ? ? b-1 pcm5 90 ? ? ? b-1 (1) port cm register (pcm) 0 outputs 0 outputs 1 pcmn 0 1 output data control (in output mode) (n = 0 to 5) pcm 0 pcm5 pcm4 pcm3 pcm2 pcm1 pcm0 after reset: 00h (output latch) r/w address: fffff00ch (2) port cm mode register (pmcm) 1 output mode input mode pmcmn 0 1 i/o mode control (n = 0 to 5) pmcm 1 pmcm5 pmcm4 pmcm3 pmcm2 pmcm1 pmcm0 after reset: ffh r/w address: fffff02ch
chapter 4 port functions preliminary user's manual u17714ej1v0ud 130 (3) port cm mode control register (pmccm) 0 pmccm 0 0 0 pmccm3 pmccm2 pmccm1 pmccm0 i/o port hldrq input pmccm3 0 1 specification of pcm3 pin operation mode i/o port hldak output pmccm2 0 1 specification of pcm2 pin operation mode i/o port clkout output pmccm1 0 1 specification of pcm1 pin operation mode i/o port wait input pmccm0 0 1 specification of pcm0 pin operation mode after reset: 00h r/w address: fffff04ch
chapter 4 port functions preliminary user's manual u17714ej1v0ud 131 4.3.12 port cs port cs is an 8-bit port for which i/o se ttings can be controll ed in 1-bit units. port cs includes the following alternate-function pins. table 4-15. port cs alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pcs0 81 cs0 output d-2 pcs1 82 cs1 output d-2 pcs2 83 cs2 output d-2 pcs3 84 cs3 output d-2 pcs4 91 ? ? b-1 pcs5 92 ? ? b-1 pcs6 93 ? ? b-1 pcs7 94 ? ? ? b-1 (1) port cs register (pcs) pcs7 outputs 0 outputs 1 pcsn 0 1 output data control (in output mode) (n = 0 to 7) pcs pcs6 pcs5 pcs4 pcs3 pcs2 pcs1 pcs0 after reset: 00h (output latch) r/w address: fffff008h (2) port cs mode register (pmcs) pmcs7 output mode input mode pmcsn 0 1 i/o mode control (n = 0 to 7) pmcs pmcs6 pmcs5 pmcs4 pmcs3 pmcs2 pmcs1 pmcs0 after reset: ffh r/w address: fffff028h
chapter 4 port functions preliminary user's manual u17714ej1v0ud 132 (3) port cs mode control register (pmccs) 0 pmccs 0 0 0 pmccs3 pmccs2 pmccs1 pmccs0 i/o port cs3 output pmccs3 0 1 specification of pcs3 pin operation mode i/o port cs2 output pmccs2 0 1 specification of pcs2 pin operation mode i/o port cs1 output pmccs1 0 1 specification of pcs1 pin operation mode i/o port cs0 output pmccs0 0 1 specification of pcs0 pin operation mode after reset: 00h r/w address: fffff048h
chapter 4 port functions preliminary user's manual u17714ej1v0ud 133 4.3.13 port ct port ct is an 8-bit port for which i/o setti ngs can be controlled in 1-bit units. port ct includes the following alternate-function pins. table 4-16. port ct alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pct0 95 wr0 output d-2 pct1 96 wr1 output d-2 pct2 97 ? ? b-1 pct3 98 ? ? b-1 pct4 99 rd output d-2 pct5 100 ? ? b-1 pct6 101 astb output d-2 pct7 102 ? ? ? b-1 (1) port ct register (pct) pct7 outputs 0 outputs 1 pctn 0 1 output data control (in output mode) (n = 0 to 7) pct pct6 pct5 pct4 pct3 pct2 pct1 pct0 after reset: 00h (output latch) r/w address: fffff00ah (2) port ct mode register (pmct) pmct7 output mode input mode pmctn 0 1 i/o mode control (n = 0 to 7) pmct pmct6 pmct5 pmct4 pmct3 pmct2 pmct1 pmct0 after reset: ffh r/w address: fffff02ah
chapter 4 port functions preliminary user's manual u17714ej1v0ud 134 (3) port ct mode control register (pmcct) 0 pmcct pmcct6 0 pmcct4 0 0 pmcct1 pmcct0 i/o port astb output pmcct6 0 1 specification of pct6 pin operation mode i/o port rd output pmcct4 0 1 specification of pct4 pin operation mode i/o port wr1 output pmcct1 0 1 specification of pct1 pin operation mode i/o port wr0 output pmcct0 0 1 specification of pct0 pin operation mode after reset: 00h r/w address: fffff04ah
chapter 4 port functions preliminary user's manual u17714ej1v0ud 135 4.3.14 port dh port dh is an 8-bit port for which i/o setti ngs can be controlled in 1-bit units. port dh includes the following alternate-function pins. table 4-17. port dh alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pdh0 121 a16 output d-2 pdh1 122 a17 output d-2 pdh2 123 a18 output d-2 pdh3 124 a19 output d-2 pdh4 125 a20 output d-2 pdh5 126 a21 output d-2 pdh6 127 a22 output d-2 pdh7 128 a23 output ? d-2 (1) port dh register (pdh) outputs 0 outputs 1 pdhn 0 1 output data control (in output mode) (n = 0 to 7) pdh after reset: 00h (output latch) r/w address: fffff006h pdh7 pdh6 pdh5 pdh4 pdh3 pdh2 pdh1 pdh0 (2) port dh mode register (pmdh) pmdh7 output mode input mode pmdhn 0 1 i/o mode control (n = 0 to 7) pmdh6 pmdh5 pmdh4 pmdh3 pmdh2 pmdh1 pmdh0 after reset: ffh r/w address: fffff026h pmdh
chapter 4 port functions preliminary user's manual u17714ej1v0ud 136 (3) port dh mode control register (pmcdh) i/o port am output (address bus output) (m = 16 to 23) pmcdhn 0 1 specification of pdhn pin operation mode (n = 0 to 7) pmcdh7 pmcdh6 pmcdh5 pmcdh4 pmcdh3 pmcdh2 pmcdh1 pmcdh0 after reset: 00h r/w address: fffff046h pmcdh
chapter 4 port functions preliminary user's manual u17714ej1v0ud 137 4.3.15 port dl port dl is a 16-bit port for which i/o se ttings can be controll ed in 1-bit units. port dl includes the following alternate-function pins. table 4-18. port dl alternate-function pins pin name pin no. alternate-function pin name i/o remark block type pdl0 105 ad0 i/o d-3 pdl1 106 ad1 i/o d-3 pdl2 107 ad2 i/o d-3 pdl3 108 ad3 i/o d-3 pdl4 109 ad4 i/o d-3 pdl5 110 ad5/flmd1 note i/o d-3 pdl6 111 ad6 i/o d-3 pdl7 112 ad7 i/o d-3 pdl8 113 ad8 i/o d-3 pdl9 114 ad9 i/o d-3 pdl10 115 ad10 i/o d-3 pdl11 116 ad11 i/o d-3 pdl12 117 ad12 i/o d-3 pdl13 118 ad13 i/o d-3 pdl14 119 ad14 i/o d-3 pdl15 120 ad15 i/o ? d-3 note since this pin is set in the flash memory progra mming mode, it does not need to be manipulated with the port control register. for details, see chapter 26 flash memory .
chapter 4 port functions preliminary user's manual u17714ej1v0ud 138 (1) port dl register (pdl) pdl15 outputs 0 outputs 1 pdln 0 1 output data control (in output mode) (n = 0 to 15) pdl14 pdl13 pdl12 pdl11 pdl10 pdl9 pdl8 after reset: 0000h (output latch) r/w address: pdl fffff004h, pdll fffff004h, pdlh fffff005h pdl7 pdl6 pdl5 pdl4 pdl3 pdl2 pdl1 pdl0 8 9 10 11 12 13 14 15 pdl (pdlh) (pdll) remarks 1. the pdl register can be read or written in 16-bit units. however, when using the higher 8 bits of the pdl register as the pdlh register and the lower 8 bits as the pdll register, pdl can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pdlh register. (2) port dl mode register (pmdl) pmdl7 output mode input mode pmdln 0 1 i/o mode control (n = 0 to 15) pmdl6 pmdl5 pmdl4 pmdl3 pmdl2 pmdl1 pmdl0 after reset: ffffh r/w address: pmdl fffff024h, pmdll fffff024h, pmdlh fffff025h pmdl15 pmdl14 pmdl13 pmdl12 pmdl11 pmdl10 pmdl9 pmdl8 8 9 10 11 12 13 14 15 pmdl (pmdlh) (pmdll) remarks 1. the pmdl register can be read or written in 16-bit units. however, when using the higher 8 bits of th e pmdl register as the pmdlh register and the lower 8 bits as the pmdll register, pmdl can be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmdlh register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 139 (3) port dl mode control register (pmcdl) i/o port adn i/o (address/data bus i/o) pmcdln 0 1 specification of pdln pin operation mode (n = 0 to 15) pmcdl7 pmcdl6 pmcdl5 pmcdl4 pmcdl3 pmcdl2 pmcdl1 pmcdl0 after reset: 0000h r/w address: pmcdl fffff044h, pmcdll fffff044h, pmcdlh fffff045h pmcdl15 pmcdl14pmcdl13 pmcdl12 pmcdl11pmcdl10 pmcdl9 pmcdl8 8 9 10 11 12 13 14 15 pmcdl (pmcdlh) (pmcdll) caution when the smsel bit of th e eximc register = 1 (separate mode) and the bs30 to bs00 bits of the bsc register = 0 (8-bit bus width) , do not specify the ad8 to ad15 pins. remarks 1. the pmcdl register can be read or written in 16-bit units. however, when using the higher 8 bits of the pmcdl register as the pmcdlh register and the lower 8 bits as the pmcdll register, pmcdl c an be read or written in 8-bit or 1-bit units. 2. to read/write bits 8 to 15 of the pmcdl register in 8-bit or 1-bit units, specify them as bits 0 to 7 of the pmcdlh register.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 140 4.4 block diagrams figure 4-3. block diagram of type a-1 address rd a/d input signal wr pm pmmn wr port pmn pmn p-ch n-ch internal bus selector selector
chapter 4 port functions preliminary user's manual u17714ej1v0ud 141 figure 4-4. block diagram of type a-2 rd d/a output signal wr pm pmmn wr port pmn pmn p-ch n-ch internal bus selector selector address figure 4-5. block diagram of type b-1 rd wr pm pmmn wr port pmn pmn internal bus selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 142 figure 4-6. block diagram of type c-1 address rd wr port pmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch internal bus selector selector
chapter 4 port functions preliminary user's manual u17714ej1v0ud 143 figure 4-7. block diagram of type d-1 wr port pmn wr pm pmmn wr pmc pmcmn rd input signal when alternate function is used pmn internal bus selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 144 figure 4-8. block diagram of type d-2 wr port pmn wr pm pmmn wr pmc pmcmn rd output signal when alternate function is used pmn internal bus selector selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 145 figure 4-9. block diagram of type d-3 wr port pmn wr pm pmmn wr pmc pmcmn rd pmn output signal when alternate function is used input signal when alternate function is used output enable signal of address/data bus input enable signal of address/data bus output buffer off signal internal bus selector selector selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 146 figure 4-10. block diagram of type e-1 address input signal when alternate function is used rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch note internal bus selector selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 147 figure 4-11. block diagram of type e-2 rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch output signal when alternate function is used internal bus selector selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 148 figure 4-12. block diagram of type e-3 rd wr port pmn wr pmc pmcmn wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch output signal when alternate function is used output enable signal when alternate function is used input signal when alternate function is used note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 149 figure 4-13. block diagram of type g-1 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal when alternate function is used pmn ev dd ev ss p-ch n-ch note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 150 figure 4-14. block diagram of type g-2 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal when alternate function is used pmn ev dd ev ss p-ch n-ch note internal bus selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 151 figure 4-15. block diagram of type g-3 output signal 2 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch internal bus selector selector selector selector address
chapter 4 port functions preliminary user's manual u17714ej1v0ud 152 figure 4-16. block diagram of type g-5 rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch input signal when alternate function is used note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 153 figure 4-17. block diagram of type g-6 output signal when alternate function is used input signal 1 when alternate function is used input signal 2 when alternate function is used note internal bus selector selector selector selector address rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 154 figure 4-18. block diagram of type g-12 input signal when alternate function is used output signal 1 when alternate function is used output signal 2 when alternate function is used note internal bus selector address rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch selector selector selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 155 figure 4-19. block diagram of type l-1 input signal 1 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm pmmn pmn ev dd ev ss p-ch n-ch edge detection noise elimination note 2 internal bus selector selector address notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 156 figure 4-20. block diagram of type l-2 address input signal 1-1 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm pmmn pmn input signal 1-2 when alternate function is used ev dd ev ss p-ch n-ch edge detection noise elimination note 2 internal bus selector selector notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 157 figure 4-21. block diagram of type n-1 input signal 1 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn input signal 2 when alternate function is used ev dd ev ss p-ch n-ch edge detection noise elimination note 2 internal bus selector selector selector address notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 158 figure 4-22. block diagram of type n-2 internal bus address input signal when alternate function is used selector selector selector rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn ev dd ev ss p-ch n-ch edge detection noise elimination note 2 output signal when alternate function is used notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 159 figure 4-23. block diagram of type n-3 input signal 1-1 when alternate function is used input signal 1-2 when alternate function is used input signal 2 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn pmmn pmn ev dd ev ss p-ch n-ch note 2 internal bus selector selector selector address edge detection noise elimination notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 160 figure 4-24. block diagram of type u-1 input signal 2 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 1 when alternate function is used input signal 3 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 161 figure 4-25. block diagram of type u-5 input signal 1-1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 1-2 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 162 figure 4-26. block diagram of type u-6 input signal 1-1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 1-2 when alternate function is used input signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 163 figure 4-27. block diagram of type u-7 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 2-1 when alternate function is used input signal 2-2 when alternate function is used output signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 164 figure 4-28. block diagram of type u-8 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal when on-chip debugging pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 165 figure 4-29. block diagram of type u-9 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used input signal when on-chip debugging output enable signal when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector selector address output signal 2 when alternate function is used output signal 1 when alternate function is used noise elimination note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 166 figure 4-30. block diagram of type u-10 internal bus address input signal 1 when alternate function is used selector selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used output signal 2 when alternate function is used output signal 3 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn noise elimination note selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 167 figure 4-31. block diagram of type u-11 internal bus address input signal 1 when alternate function is used selector selector selector selector rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 3 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn input signal 2 when alternate function is used ev dd ev ss p-ch n-ch wr pfce pfcemn noise elimination note selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 168 figure 4-32. block diagram of type u-12 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 169 figure 4-33. block diagram of type u-13 input signal when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 170 figure 4-34. block diagram of type u-14 input signal 1 when alternate function is used rd wr port pmn wr pfc pfcmn wr pf pfmn wr pmc pmcmn wr pm pmmn input signal 2 when alternate function is used output signal 2 when alternate function is used output signal 1 when alternate function is used pmn ev dd ev ss p-ch n-ch wr pfce pfcemn note internal bus selector selector selector selector address selector note hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 171 figure 4-35. block diagram of type u-15 input signal 1 when alternate function is used input signal 2 when alternate function is used rd wr port pmn wr pmc pmcmn wr intr intrmn note 1 wr intf intfmn note 1 wr pf pfmn wr pm wr pfc pfcmn wr pfce pfcemn pmmn pmn ev dd ev ss p-ch n-ch output signal 2 when alternate function is used output signal 1 when alternate function is used note 2 internal bus selector selector selector selector address edge detection noise elimination selector notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 172 figure 4-36. block diagram of type aa-1 rd wr port pmn wr intf intfmn note 1 wr pf pfmn wr ocdm0 ocdm0 wr pmc pmcmn wr pm pmmn pmn ev dd ev ss p-ch n-ch n-ch wr intr intrmn note 1 ev ss input signal when on-chip debugging external reset signal input signal when alternate function is used note 2 internal bus selector selector address edge detection noise elimination notes 1. see 19.6 external interrupt request i nput pins (nmi and intp0 to intp8) . 2. hysteresis characteristics are not available in port mode. 4.5 port register settings when alternate function is used table 4-19 shows the port register settings when each port is used for an alternate function. when using a port pin as an alternate-function pin, refer to the description of each pin.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 173 table 4-19. using port pin as alternate-function pin (1/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tip61 input p00 = setting not required pm00 = setting not required pmc00 = 1 ? pfc00 = 0 p00 top61 output p00 = setting not required pm00 = setting not required pmc00 = 1 ? pfc00 = 1 tip60 input p01 = setting not required pm01 = setting not required pmc01 = 1 ? pfc01 = 0 p01 top60 output p01 = setting not required pm01 = setting not required pmc01 = 1 ? pfc01 = 1 p02 nmi input p02 = setting not required pm02 = setting not required pmc02 = 1 ? ? intp0 input p03 = setting not required pm03 = setting not required pmc03 = 1 ? pfc03 = 0 p03 adtrg input p03 = setting not required pm03 = setting not required pmc03 = 1 ? pfc03 = 1 p04 intp1 input p04 = setting not required pm04 = setting not required pmc04 = 1 ? ? intp2 input p05 = setting not required pm05 = setting not required pmc05 = 1 ? ? p05 drst input p05 = setting not required pm05 = setting not required pmc05 = setting not required ? ? ocdm0 (ocdm) = 1 p06 intp3 input p06 = setting not required pm06 = setting not required pmc06 = 1 ? ? p10 ano0 output p10 = setting not required pm10 = 1 ? ? ? p11 ano1 output p11 = setting not required pm11 = 1 ? ? ? txda0 output p30 = setting not required pm30 = setting not required pmc30 = 1 ? pfc30 = 0 p30 sob4 output p30 = setting not required pm30 = setting not required pmc30 = 1 ? pfc30 = 1 rxda0 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? note , pfc31 = 0 intp7 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? note , pfc31 = 0 p31 sib4 input p31 = setting not required pm31 = setting not required pmc31 = 1 ? pfc31 = 1 ascka0 input p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 0 pfc32 = 0 sckb4 i/o p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 0 pfc32 = 1 tip00 input p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 1 pfc32 = 0 p32 top00 output p32 = setting not required pm32 = setting not required pmc32 = 1 pfce32 = 1 pfc32 = 1 note the intp7 pin and rxda0 pin are alternate-function pins. when us ing the pin as the rxda0 pin, disable edge detection for the intp7 alternate-function pin. (clear the intf3.intf31 bit and the inrt3.intr31 bit to 0.) when usi ng the pin as the intp7 pin, st op uarta0 reception. (clea r the ua0ctl0.ua0rxe bit to 0.) caution between the p10 and p11 pins, when one pin is used as the i/o port, and the ot her pin is used as the d/a output pin (an o0, ano1), make sure that the port i/o level does not change during d/a output.
chapter 4 port functions 174 preliminary user's manual u17714ej1v0ud table 4-19. using port pin as alternate-function pin (2/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tip01 input p33 = setting not required pm33 = setting not required pmc33 = 1 ? pfc33 = 0 p33 top01 output p33 = setting not required pm33 = setting not required pmc33 = 1 ? pfc33 = 1 tip10 input p34 = setting not required pm34 = setting not required pmc34 = 1 ? pfc34 = 0 p34 top10 input p34 = setting not required pm34 = setting not required pmc34 = 1 ? pfc34 = 1 tip11 input p35 = setting not required pm35 = setting not required pmc35 = 1 ? pfc35 = 0 p35 top11 output p35 = setting not required pm35 = setting not required pmc35 = 1 ? pfc35 = 1 txda2 output p38 = setting not required pm38 = setting not required pmc38 = 1 ? pfc38 = 0 p38 sda00 i/o p38 = setting not required pm38 = setting not required pmc38 = 1 ? pfc38 = 1 rxda2 input p39 = setting not required pm39 = setting not required pmc39 = 1 ? pfc39 = 0 p39 scl00 i/o p39 = setting not required pm39 = setting not required pmc39 = 1 ? pfc39 = 1 sib0 input p40 = setting not required pm40 = setting not required pmc40 = 1 ? pfc40 = 0 p40 sda01 i/o p40 = setting not required pm40 = setting not required pmc40 = 1 ? pfc40 = 1 sob0 output p41 = setting not required pm41 = setting not required pmc41 = 1 ? pfc41 = 0 p41 scl01 i/o p41 = setting not required pm41 = setting not required pmc41 = 1 ? pfc41 = 1 p42 sckb0 i/o p42 = setting not required pm42 = setting not required pmc42 = 1 ? ? tiq01 input p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 0 pfc50 = 1 krm0 (krm) = 0 kr0 input p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 0 pfc50 = 1 tq0tig2, tq0tig3 (tq0ioc1) = 0 toq01 output p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 1 pfc50 = 0 p50 rtp00 output p50 = setting not required pm50 = setting not required pmc50 = 1 pfce50 = 1 pfc50 = 1 tiq02 input p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 0 pfc51 = 1 krm1 (krm) = 0 kr1 input p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 0 pfc51 = 1 tq0tig4, tq0tig5 (tq0ioc1) = 0 toq02 output p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 1 pfc51 = 0 p51 rtp01 output p51 = setting not required pm51 = setting not required pmc51 = 1 pfce51 = 1 pfc51 = 1 tiq03 input p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 0 pfc52 = 1 krm2 (krm) = 0 kr2 input p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 0 pfc52 = 1 tq0tig6, tq0tig7 (tq0i0c1) = 0 toq03 output p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 1 pfc52 = 0 rtp02 output p52 = setting not required pm52 = setting not required pmc52 = 1 pfce52 = 1 pfc52 = 1 p52 ddi input p52 = setting not required pm52 = setting not required pmc52 = setting not required pfce52 = setting not required pfc52 = setting not required ocdm0 (ocdm) = 1
chapter 4 port functions preliminary user's manual u17714ej1v0ud 175 table 4-19. using port pin as alternate-function pin (3/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) sib2 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 0 tiq00 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 1 krm3 (krm) = 0 kr3 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 0 pfc53 = 1 tq 0tig0, tq0tig1 (tq0ioc1) = 0, tq0ees0, tq0ees1 (tq0ioc2) = 0, tq0ets0, tq0ets1 (tq0ioc2) = 0 toq00 input p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 1 pfc53 = 0 rtp03 output p53 = setting not required pm53 = setting not required pmc53 = 1 pfce53 = 1 pfc53 = 1 p53 ddo output p53 = setting not required pm53 = setting not required pmc53 = setting not required pfce53 = setting not required pfc53 = setting not required ocdm0 (ocdm) = 1 sob2 output p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 0 pfc54 = 0 kr4 input p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 0 pfc54 = 1 rtp04 output p54 = setting not required pm54 = setting not required pmc54 = 1 pfce54 = 1 pfc54 = 1 p54 dck input p54 = setting not required pm54 = setting not required pmc54 = setting not required pfce54 = setting not required pfc54 = setting not required ocdm0 (ocdm) = 1 sckb2 i/o p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 0 pfc55 = 0 kr5 input p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 0 pfc55 = 1 rtp05 output p55 = setting not required pm55 = setting not required pmc55 = 1 pfce55 = 1 pfc55 = 1 p55 dms input p55 = setting not required pm55 = setting not required pmc55 = setting not required pfce55 = setting not required pfc55 = setting not required ocdm0 (ocdm) = 1 p60 rtp10 output p60 = setting not required pm60 = setting not required pmc60 = 1 ? ? p61 rtp11 output p61 = setting not required pm61 = setting not required pmc61 = 1 ? ? p62 rtp12 output p62 = setting not required pm62 = setting not required pmc62 = 1 ? ? p63 rtp13 output p63 = setting not required pm63 = setting not required pmc63 = 1 ? ? p64 rtp14 output p64 = setting not required pm64 = setting not required pmc64 = 1 ? ? p65 rtp15 output p65 = setting not required pm65 = setting not required pmc65 = 1 ? ? p66 sib5 input p66 = setting not required pm66 = setting not required pmc66 = 1 ? ? p67 sob5 output p67 = setting not required pm67 = setting not required pmc67 = 1 ? ? p68 sckb5 i/o p68 = setting not required pm68 = setting not required pmc68 = 1 ? ? tip70 input p69 = setting not required pm69 = setting not required pmc69 = 1 ? pfc69 = 0 p69 top70 output p69 = setting not required pm69 = setting not required pmc69 = 1 ? pfc69 = 1 p610 tip71 input p610 = setting not required pm610 = setting not required pmc610 = 1 ? ? p611 top71 output p611 = setting not required pm611 = setting not required pmc611 = 1 ? ?
chapter 4 port functions 176 preliminary user's manual u17714ej1v0ud table 4-19. using port pin as alternate-function pin (4/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) tip80 input p612 = setting not required pm612 = setting not required pmc612 = 1 ? pfc612 = 0 p612 top80 output p612 = setting not required pm612 = setting not required pmc612 = 1 ? pfc612 = 1 tip81 input p613 = setting not required pm613 = setting not required pmc613 = 1 ? pfc613 = 0 p613 top81 output p613 = setting not required pm613 = setting not required pmc613 = 1 ? pfc613 = 1 p70 ani0 input p70 = setting not required pm70 = 1 ? ? ? p71 ani1 input p71 = setting not required pm71 = 1 ? ? ? p72 ani2 input p72 = setting not required pm72 = 1 ? ? ? p73 ani3 input p73 = setting not required pm73 = 1 ? ? ? p74 ani4 input p74 = setting not required pm74 = 1 ? ? ? p75 ani5 input p75 = setting not required pm75 = 1 ? ? ? p76 ani6 input p76 = setting not required pm76 = 1 ? ? ? p77 ani7 input p77 = setting not required pm77 = 1 ? ? ? p78 ani8 input p78 = setting not required pm78 = 1 ? ? ? p79 ani9 input p79 = setting not required pm79 = 1 ? ? ? p710 ani10 input p710 = setting not required pm710 = 1 ? ? ? p711 ani11 input p711 = setting not required pm711 = 1 ? ? ? p712 ani12 input p712 = setting not required pm712 = 1 ? ? ? p713 ani13 input p713 = setting not required pm713 = 1 ? ? ? p714 ani14 input p714 = setting not required pm714 = 1 ? ? ? p715 ani15 input p715 = setting not required pm715 = 1 ? ? ? rxda3 input p80 = setting not required pm80 = setting not required pmc80 = 1 ? ? note p80 intp8 input p80 = setting not required pm80 = setting not required pmc80 = 1 ? ? note p81 txda3 output p81 = setting not required pm81 = setting not required pmc81 = 1 ? ? note the intp8 pin and rxda3 pin are alternate-function pins. when us ing the pin as the rxda3 pin, disable edge detection for the intp8 alternate-function pin. (clear the intf8.intf80 bit and the intr8.intr80 bit to 0.) when us ing the pin as the intp8 pin, st op uarta3 reception. (clea r the ua0ctl3.ua3rxe bit to 0.)
chapter 4 port functions preliminary user's manual u17714ej1v0ud 177 table 4-19. using port pin as alternate-function pin (5/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) a0 output p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 0 pfc90 = 0 note 1 kr6 input p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 0 pfc90 = 1 txda1 output p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 1 pfc90 = 0 p90 sda02 i/o p90 = setting not required pm90 = setting not required pmc90 = 1 pfce90 = 1 pfc90 = 1 a1 output p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 0 pfc91 = 0 note 1 kr7 input p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 0 pfc91 = 1 rxda1/kr7 note 2 input p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 1 pfc91 = 0 p91 scl02 i/o p91 = setting not required pm91 = setting not required pmc91 = 1 pfce91 = 1 pfc91 = 1 a2 output p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 0 pfc92 = 0 note 1 tip41 input p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 0 pfc92 = 1 p92 top41 output p92 = setting not required pm92 = setting not required pmc92 = 1 pfce92 = 1 pfc92 = 0 a3 output p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 0 pfc93 = 0 note 1 tip40 input p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 0 pfc93 = 1 p93 top40 output p93 = setting not required pm93 = setting not required pmc93 = 1 pfce93 = 1 pfc93 = 0 a4 output p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 0 pfc94 = 0 note 1 tip31 input p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 0 pfc94 = 1 p94 top31 output p94 = setting not required pm94 = setting not required pmc94 = 1 pfce94 = 1 pfc94 = 0 a5 output p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 0 pfc95 = 0 note 1 tip30 input p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 0 pfc95 = 1 p95 top30 output p95 = setting not required pm95 = setting not required pmc95 = 1 pfce95 = 1 pfc95 = 0 a6 output p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 0 pfc96 = 0 note 1 tip21 input p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 1 pfc96 = 0 p96 top21 output p96 = setting not required pm96 = setting not required pmc96 = 1 pfce96 = 1 pfc96 = 1 notes 1. when setting pins a0 to a15 as the alternate function, set the pmc9 register to ffffh for all 16 bits at once. 2. the rxda1 and kr7 pins must not be used at the same time. w hen using the rxda1 pin, do not use the kr7 pin. when using the k r7 pin, do not use the rxda1 pin (it is recommended to set the pfc91 bit to 1 and clear the pfce91 bit to 0).
chapter 4 port functions 178 preliminary user's manual u17714ej1v0ud table 4-19. using port pin as alternate-function pin (6/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) a7 output p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 0 pfc97 = 0 note sib1 input p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 0 pfc97 = 1 tip20 input p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 1 pfc97 = 0 p97 top20 output p97 = setting not required pm97 = setting not required pmc97 = 1 pfce97 = 1 pfc97 = 1 a8 output p98 = setting not required pm98 = setting not required pmc98 = 1 ? pfc98 = 0 note p98 sob1 output p98 = setting not required pm98 = setting not required pmc98 = 1 ? pfc98 = 1 a9 output p99 = setting not required pm99 = setting not required pmc99 = 1 ? pfc99 = 0 note p99 sckb1 i/o p99 = setting not required pm99 = setting not required pmc99 = 1 ? pfc99 = 1 a10 output p910 = setting not required pm910 = setting not required pmc910 = 1 ? pfc910 = 0 note p910 sib3 input p910 = setting not required pm910 = setting not required pmc910 = 1 ? pfc910 = 1 a11 output p911 = setting not required pm911 = setting not required pmc911 = 1 ? pfc911 = 0 note p911 sob3 output p911 = setting not required pm911 = setting not required pmc911 = 1 ? pfc911 = 1 a12 output p912 = setting not required pm912 = setting not required pmc912 = 1 ? pfc912 = 0 note p912 sckb3 i/o p912 = setting not required pm912 = setting not required pmc912 = 1 ? pfc912 = 1 a13 output p913 = setting not required pm913 = setting not required pmc913 = 1 ? pfc913 = 0 note p913 intp4 input p913 = setting not required pm913 = setting not required pmc913 = 1 ? pfc913 = 1 a14 output p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 0 pfc914 = 0 note intp5 input p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 0 pfc914 = 1 tip51 input p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 1 pfc914 = 0 p914 top51 output p914 = setting not required pm914 = setting not required pmc914 = 1 pfce914 = 1 pfc914 = 1 a15 output p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 0 pfc915 = 0 note intp6 input p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 0 pfc915 = 1 tip50 input p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 1 pfc915 = 0 p915 top50 output p915 = setting not required pm915 = setting not required pmc915 = 1 pfce915 = 1 pfc915 = 1 pcs0 cs0 output pcs0 = setting not required pmcs0 = setting not required pmccs0 = 1 ? ? pcs1 cs1 output pcs1 = setting not required pmcs1 = setting not required pmccs1 = 1 ? ? pcs2 cs2 output pcs2 = setting not required pmcs2 = setting not required pmccs2 = 1 ? ? pcs3 cs3 output pcs3 = setting not required pmcs3 = setting not required pmccs3 = 1 ? ? note when setting pins a0 to a15 as the alternate function, se t the pmc9 register to ffffh for all 16 bits at once.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 179 table 4-19. using port pin as alternate-function pin (7/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) pcm0 wait input pcm0 = setting not required pmcm0 = setting not required pmccm0 = 1 ? ? pcm1 clkout output pcm1 = setting not required pmcm1 = setting not required pmccm1 = 1 ? ? pcm2 hldak output pcm2 = setting not required pmcm2 = setting not required pmccm2 = 1 ? ? pcm3 hldrq input pcm3 = setting not required pmcm3 = setting not required pmccm3 = 1 ? ? pct0 wr0 output pct0 = setting not required pmct0 = setting not required pmcct0 = 1 ? ? pct1 wr1 output pct1 = setting not required pmct1 = setting not required pmcct1 = 1 ? ? pct4 rd output pct4 = setting not required pmct4 = setting not required pmcct4 = 1 ? ? pct6 astb output pct6 = setting not required pmct6 = setting not required pmcct6 = 1 ? ? pdh0 a16 output pdh0 = setting not required pmdh0 = setting not required pmcdh0 = 1 ? ? pdh1 a17 output pdh1 = setting not required pmdh1 = setting not required pmcdh1 = 1 ? ? pdh2 a18 output pdh2 = setting not required pmdh2 = setting not required pmcdh2 = 1 ? ? pdh3 a19 output pdh3 = setting not required pmdh3 = setting not required pmcdh3 = 1 ? ? pdh4 a20 output pdh4 = setting not required pmdh4 = setting not required pmcdh4 = 1 ? ? pdh5 a21 output pdh5 = setting not required pmdh5 = setting not required pmcdh5 = 1 ? ? pdh6 a22 output pdh6 = setting not required pmdh6 = setting not required pmcdh6 = 1 ? ? pdh7 a23 output pdh7 = setting not required pmdh7 = setting not required pmcdh7 = 1 ? ? pdl0 ad0 i/o pdl0 = setting not required pmdl0 = setting not required pmcdl0 = 1 ? ? pdl1 ad1 i/o pdl1 = setting not required pmdl1 = setting not required pmcdl1 = 1 ? ? pdl2 ad2 i/o pdl2 = setting not required pmdl2 = setting not required pmcdl2 = 1 ? ? pdl3 ad3 i/o pdl3 = setting not required pmdl3 = setting not required pmcdl3 = 1 ? ? pdl4 ad4 i/o pdl4 = setting not required pmdl4 = setting not required pmcdl4 = 1 ? ? ad5 i/o pdl5 = setting not required pmdl5 = setting not required pmcdl5 = 1 ? ? pdl5 flmd1 note input pdl5 = setting not required pmdl5 = setting not required pmcdl5 = setting not required ? ? pdl6 ad6 i/o pdl6 = setting not required pmdl6 = setting not required pmcdl6 = 1 ? ? pdl7 ad7 i/o pdl7 = setting not required pmdl7 = setting not required pmcdl7 = 1 ? ? note since this pin is set in the flash memory programming mode, it does not need to be manipulated with the port control register. for details, see chapter 26 flash memory .
chapter 4 port functions 180 preliminary user's manual u17714ej1v0ud table 4-19. using port pin as alternate-function pin (8/8) alternate function pin name name i/o pnx bit of pn register pmnx bit of pmn register pmcnx bit of pmcn register pfcenx bit of pfcen register pfcnx bit of pfcn register other bits (registers) pdl8 ad8 i/o pdl8 = setting not required pmdl8 = setting not required pmcdl8 = 1 ? ? pdl9 ad9 i/o pdl9 = setting not required pmdl9 = setting not required pmcdl9 = 1 ? ? pdl10 ad10 i/o pdl10 = setting not required pmdl10 = setting not required pmcdl10 = 1 ? ? pdl11 ad11 i/o pdl11 = setting not required pmdl11 = setting not required pmcdl11 = 1 ? ? pdl12 ad12 i/o pdl12 = setting not required pmdl12 = setting not required pmcdl12 = 1 ? ? pdl13 ad13 i/o pdl13 = setting not required pmdl13 = setting not required pmcdl13 = 1 ? ? pdl14 ad14 i/o pdl14 = setting not required pmdl14 = setting not required pmcdl14 = 1 ? ? pdl15 ad15 i/o pdl15 = setting not required pmdl15 = setting not required pmcdl15 = 1 ? ?
chapter 4 port functions preliminary user's manual u17714ej1v0ud 181 4.6 cautions 4.6.1 cautions on setting port pins (1) in the v850es/jj2, the general-purpose port function and several peripheral function i/o pin share a pin. to switch between the genera l-purpose port (port mode) an d the peripheral function i/o pin (alternate-function mode), set by the pmcn register. in regards to this register setting sequence, note with caution the following. (a) cautions on switching from por t mode to alternate-function mode to switch from the port mode to alternat e-function mode in the following order. <1> set the pfn register note : n-ch open-drain setting <2> set the pfcn and pfcen regist ers: alternate-function selection <3> set the corresponding bit of the pmcn regist er to 1: switch to alternate-function mode if the pmcn register is set first, note with caution tha t, at that moment or depend ing on the change of the pin states in accordance with the setting of the pf n, pfcn, and pfcen register s, unexpected operations may occur. a concrete example is shown as example below. note no-ch open-drain output pin only caution regardless of the port mo de/alternate-function mode, the pn register is read and written as follows. ? pn register read: read the port output latc h value (when pmn.pmnm bit = 0), or read the pin states (pmn.pmnm bit = 1). ? pn register write: write to the port output latch [example] scl01 pin setting example the scl01 pin is used alternately with the p41/ sob0 pin. select the valid pin functions with the pmc4, pfc4, and pf4 registers. pmc41 bit pfc41 bit pf41 bit valid pin functions 0 don't care 1 p41 (in output port mode, n-ch open-drain output) 0 1 sob0 output (n-ch open-drain output) 1 1 1 scl01 i/o (n-ch open-drain output)
chapter 4 port functions preliminary user's manual u17714ej1v0ud 182 the order of setting in which malfunction ma y occur on switching from the p41 pin to the scl01 pin are shown below. setting order setting contents pin states pin level <1> initial value (pmc41 bit = 0, pfc41 bit = 0, pf41 bit = 0) port mode (input) hi-z <2> pmc41 bit 1 sob0 output low level (high level depending on the csib0 setting) <3> pfc41 bit 1 scl01 i/o high level (cmos output) <4> pf41 bit 1 scl01 i/o hi-z (n-ch open-drain output) in <2>, i 2 c communication may be affected since the alternate-function so b0 output is output to the pin. in the cmos output period of <2 > or <3>, unnecessary current may be generated. (b) cautions on alternate-function mode (input) the input signal to the alternate-function block is low level when the pmcn.pmcnm bit is 0 due to the and output of the pmcn register set value and the pin level. thus, depending on the port setting and alternate- function operation enable timing, unexpected operati ons may occur. therefore, switch between the port mode and alternate-function m ode in the following sequence. ? to switch from port mode to alternate-function mode (input) set the pins to the alternate-function mode using the pmcn register and then enable the alternate- function operation. ? to switch from alternate-function mode (input) to port mode stop the alternate-function operation and then switch the pins to the port mode. the concrete examples are show n as example 1 and example 2. [example 1] switch from general-purpose por t (p02) to external interrupt pin (nmi) when the p02/nmi pin is pulled up as shown in figure 4-37 and the rising edge is specified in the nmi pin edge detection setting, even though high level is input continuously to the nmi pin during switching from the p02 pin to the an nmi pin (pmc02 bit = 0 1), this is detected as a rising edge as if the low level changed to high level, and an nmi interrupt occurs. to avoid it, set the nmi pin's valid edge afte r switching from the p02 pin to the nmi pin.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 183 figure 4-37. example of switching from p02 to nmi (incorrect) pmc0 nmi interrupt occurrence 76543 2 p02/nmi 3 v 10 0 1 pmc0m bit = 0: port mode pmc0m bit = 1: alternate-function mode rising edge detector pmc02 bit = 0: low level pmc02 bit = 1: high level remark m = 0 to 7 [example 2] switch from external pin (nmi) to general-purpose port (p02) when the p02/nmi pin is pulled up as shown in figure 4-38 and the falling edge is specified in the nmi pin edge detection setting, even though high level is input continuously to the nmi pin at switching from the nmi pin to the p02 pin (pmc02 bit = 1 0), this is detected as falling edge as if high level changed to low level, and nmi interrupt occurs. to avoid this, set the nmi pin edge detection as "no edge detected" before switching to the p02 pin. figure 4-38. example of switching from nmi to p02 (incorrect) pmc0 76543 2 p02/nmi 3 v 10 nmi interrupt occurrence 1 0 pmc0m bit = 0: port mode pmc0m bit = 1: alternate-function mode falling edge detector pmc02 bit = 1: high level pmc02 bit = 0: low level remark m = 0 to 7 (2) in port mode, the pfn.pfnm bit is valid only in t he output mode (pmn.pmnm bit = 0). in the input mode (pmnm bit = 1), the value of the pfnm bit is not reflected in the buffer.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 184 4.6.2 cautions on bit manipulation instruction for port n register (pn) when a 1-bit manipulation instruction is executed on a por t that provides both input an d output functions, the value of the output latch of an input port that is not subject to manipulation may be written in addition to the targeted bit. therefore, it is recommended to rewr ite the output latch when switching a port from input mode to output mode. when p90 pin is an output port, p91 to p97 pins are input ports (all pin statuses are high level), and the value of the port latch is 00h, if the output of p 90 pin is changed from low level to high level via a bit manipulation instruction, t he value of the port latch is ffh. explanation: the targets of writing to and reading from the pn register of a port whose pmnm bit is 1 are the output latch and pin status, respectively. a bit manipulation instruction is executed in the following order in the v850es/jj2. <1> the pn register is read in 8-bit units. <2> the targeted one bit is manipulated. <3> the pn register is written in 8-bit units. in step <1>, the value of the output latch (0) of p90 pin, which is an output port, is read, while the pin statuses of p91 to p97 pins, which are input ports, are read. if the pin statuses of p91 to p97 pins are high level at this time, the read value is feh. the value is changed to ffh by the manipulation in <2>. ffh is written to the output la tch by the manipulation in <3>. figure 4-39. bit manipula tion instruction (p90 pin) low-level output bit manipulation instruction (set1 0, p9l[r0]) is executed for p90 bit. pin status: high level p90 p91 to p97 port 9l latch 00000000 high-level output pin status: high level p90 p91 to p97 port 9l latch 11111111 bit manipulation instruction for p90 bit <1> p9l register is read in 8-bit units. ? in the case of p90, an output port, the value of the port latch (0) is read.  in the case of p91 to p97, input ports, the pin status (1) is read. <2> set (1) p90 bit. <3> write the results of <2> to the output latch of p9l register in 8-bit units.
chapter 4 port functions preliminary user's manual u17714ej1v0ud 185 4.6.3 cautions on on-chip debug pins the drst, dck, dms, ddi, and ddo pins are on-chip debug pins. after reset by the reset pin, the p05/intp2/drst pin is in itialized to function as an on-chip debug pin (drst). if a high level is input to the drst pin at this time, the on-chip debug mode is set, and the dck, dms, ddi, and ddo pins can be used. the following action must be taken if on-chip debugging is not used. ? clear the ocdm0 bit of the ocdm register (special register) (0) at this time, fix the p05/intp2/drst pin to low level from when reset by the reset pin is released until the above action is taken. if a high level is input to the drst pin before the above action is taken, it may cause a malfunction (cpu deadlock). handle the p05 pin with the utmost care. caution after reset by the wdt2res signal, clock m onitor (clm), or low-voltage detector (lvi), the p05/intp2/drst pin is not initialized to func tion as an on-chip debug pin (drst). the ocdm register holds the current value. 4.6.4 cautions on p05/intp2/drst pin the p05/intp2/drst pin has an internal pull-down resistor (30 k ? typ.). after a reset by the reset pin, a pull- down resistor is connected. the pull-down resistor is disconnected when the ocdm0 bit is cleared (0). 4.6.5 cautions on p10, p11, and p53 pins when power is turned on when the power is turned on, the following pins may output an undefined level temporarily, even during reset. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp03/ddo pin 4.6.6 hysteresis characteristics in port mode, the following port pins do not have hysteresis characteristics. p00 to p06 p31 to p35, p38, p39 p40 to p42 p50 to p55 p66, p68 to p610, p612, p613 p80 p90 to p97, p99, p910, p912 to p915
preliminary user's manual u17714ej1v0ud 186 chapter 5 bus control function the v850es/jj2 is provided with an external bus interface function by which external memories such as rom and ram, and i/o can be connected. 5.1 features output is selectable from a multiplexed bus with a mi nimum of 3 bus cycles and a separate bus with a minimum of 2 bus cycles. 8-bit/16-bit data bus selectable wait function ? programmable wait function of up to 7 states ? external wait function using wait pin idle state function bus hold function up to 16 mb of physical memory connectable (of which 1 mb is internal rom space) the bus can be controlled at a different voltage from the operating voltage when bv dd ev dd = v dd . however, set bv dd = ev dd = v dd in the separate bus mode.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 187 5.2 bus control pins the pins used to connect an external device are listed in the table below. table 5-1. bus control pins (multiplexed bus) bus control pin alternate-function pin i/o function ad0 to ad15 pdl0 to pdl15 i/o address/data bus a16 to a23 pdh0 to pdh7 output address bus wait pcm0 input external wait control clkout pcm1 output internal system clock wr0, wr1 pct0, pct1 output write strobe signal rd pct4 output read strobe signal astb pct6 output address strobe signal hldrq pcm3 input hldak pcm2 output bus hold control cs0 to cs3 pcs0 to pcs3 output chip select table 5-2. external control pins (separate bus) bus control pin alternate-function pin i/o function ad0 to ad15 pdl0 to pdl15 i/o data bus a0 to a15 p90 to p915 output address bus a16 to a23 pdh0 to pdh7 output address bus wait pcm0 input external wait control clkout pcm1 output internal system clock wr0, wr1 pct0, pct1 output write strobe signal rd pct4 output read strobe signal hldrq pcm3 input hldak pcm2 output bus hold control cs0 to cs3 pcs0 to pcs3 output chip select 5.2.1 pin status when internal rom, intern al ram, or on-chip peripheral i/o is accessed when the internal rom, internal ram, or on-chip peripheral i/o are accessed, the status of each pin is as follows. table 5-3. pin statuses when internal rom, in ternal ram, or on-chip peripheral i/o is accessed separate bus mode multiplexed bus mode address bus (a23 to a0) undefined a ddress bus (a23 to a16) undefined data bus (ad15 to ad0) hi-z address/data bus (ad15 to ad0) undefined control signal inactive control signal inactive caution when a write access is perfo rmed to the internal rom area, address, data, and control signals are activated in the same way as acce ss to the external memory area. 5.2.2 pin status in each operation mode for the pin status of the v850 es/jj2 in each operation mode, see 2.2 pin states .
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 188 5.3 memory block function the 16 mb external memory space is divided into memory blocks of (lower) 2 mb, 2 mb, 4 mb, and 8 mb. the programmable wait function and bus cycl e operation mode for each of these bloc ks can be independen tly controlled in one-block units. figure 5-1. data memory map: physical address (64 kb) use prohibited external memory area (8 mb) internal rom area note (1 mb) external memory area (1 mb) internal ram area (60 kb) on-chip peripheral i/o area (4 kb) external memory area (4 mb) external memory area (2 mb) (2 mb) 03ffffffh 03ff0000h 03feffffh 01000000h 00ffffffh 00800000h 007fffffh 00400000h 003fffffh 00200000h 001fffffh 00000000h 03ffffffh 03fff000h 03ffefffh 001fffffh 00100000h 000fffffh 00000000h cs3 cs2 cs1 cs0 03ff0000h note this area is an external memory area in the case of a data write access.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 189 5.4 external bus interface mode control function the v850es/jj2 includes the following two external bus interface modes. ? multiplexed bus mode ? separate bus mode these two modes can be selected by using the eximc register. (1) external bus interface mode control register (eximc) the eximc register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 multiplexed bus mode separate bus mode smsel 0 1 mode selection eximc 0 0 0 0 0 0 smsel after reset: 00h r/w address: ffffffbeh caution set the eximc register fr om the internal rom or internal ram area before making an external access. after setting the eximc register, be sure to insert a nop instruction.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 190 5.5 bus access 5.5.1 number of clocks for access the following table shows the number of basic clocks required for accessing each resource. area (bus width) bus cycle type internal rom (32 bits) internal ram (32 bits) external memory (16 bits) instruction fetch (normal access) 1 1 note 1 3 + n note 2 instruction fetch (branch) 2 2 note 1 3 + n note 2 operand data access 3 1 3 + n note 2 notes 1. increases by 1 if a conflict with a data access occurs. 2. 2 + n clocks (n: number of wait states ) when the separate bus mode is selected. remark unit: clocks/access 5.5.2 bus size setting function each external memory area selected by csn can be set by using the bsc register. however, the bus size can be set to 8 bits and 16 bits only. the external memory area of the v850es/jj2 is selected by cs0 to cs3. (1) bus size configuration register (bsc) the bsc register can be read or written in 16-bit units. reset sets this register to 5555h. caution write to the bsc register after reset, an d then do not change the set values. also, do not access an external memory area until the initial settings of the bsc register are complete. after reset: 5555h r/w address: fffff066h 0 0 bsn0 0 1 8 bits 16 bits bsc 1 bs30 0 0 1 bs20 0 0 1 bs10 0 0 1 bs00 8 9 10 11 12 13 data bus width of csn space (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 caution be sure to set bits 14, 12, 10, and 8 to ?1?, and clear bits 15, 13, 11, 9, 7, 5, 3, and 1 to ?0?.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 191 5.5.3 access by bus size the v850es/jj2 accesses the on-chip peripheral i/o and exter nal memory in 8-bit, 16-bit, or 32-bit units. the bus size is as follows. ? the bus size of the on-chip peripheral i/o is fixed to 16 bits. ? the bus size of the external memory is selectable from 8 bits or 16 bits (by using the bsc register). the operation when each of the above is accessed is described below. all data is accessed starting from the lower side. the v850es/jj2 supports only the little-endian format. figure 5-2. little-endian address in word 000bh 000ah 0009h 0008h 0007h 0006h 0005h 0004h 0003h 0002h 0001h 0000h 31 24 23 16 15 8 7 0 (1) data space the v850es/jj2 has an address misalign function. with this function, data can be placed at all addresse s, regardless of the format of the data (word data or halfword data). however, if the word data or halfword data is not aligned at the boundary, a bus cycle is generated at least twice, causing the bus efficiency to drop. (a) halfword-length data access a byte-length bus cycle is generated twice if t he least significant bit of the address is 1. (b) word-length data access (i) a byte-length bus cycle, halfwo rd-length bus cycle, and byte-lengt h bus cycle are generated in that order if the least significant bit of the address is 1. (ii) a halfword-length bus cycle is generated twic e if the lower 2 bits of the address are 10.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 192 (2) byte access (8 bits) (a) 16-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 byte data 15 8 external data bus 2n address 7 0 7 0 15 8 2n + 1 address byte data external data bus (b) 8-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 2n address byte data external data bus 7 0 7 0 2n + 1 address byte data external data bus
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 193 (3) halfword access (16 bits) (a) with 16-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) 7 0 7 0 15 8 2n address 15 8 2n + 1 halfword data external data bus first access second access 7 0 7 0 15 8 15 8 7 0 7 0 15 8 15 8 2n + 2 halfword data external data bus 2n address halfword data external data bus address 2n + 1 (b) 8-bit data bus width <1> access to even address (2n) <2> access to odd address (2n + 1) first access second access 7 0 7 0 15 8 address 7 0 7 0 15 8 2n + 1 address 2n halfword data external data bus halfword data external data bus first access second access 7 0 7 0 15 8 7 0 7 0 15 8 2n + 2 2n + 1 address address halfword data external data bus halfword data external data bus
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 194 (4) word access (32 bits) (a) 16-bit data bus width (1/2) <1> access to address (4n) first access second access 7 0 7 0 15 8 4n 15 8 4n + 1 23 16 31 24 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 word data external data bus address word data external data bus address <2> access to address (4n + 1) first access second access third access 7 0 7 0 15 8 15 8 4n + 1 23 16 31 24 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 195 (a) 16-bit data bus width (2/2) <3> access to address (4n + 2) first access second access 7 0 7 0 15 8 4n + 2 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 4n + 5 23 16 31 24 word data external data bus address word data external data bus address <4> access to address (4n + 3) first access second access third access 7 0 7 0 15 8 15 8 4n + 3 23 16 31 24 7 0 7 0 15 8 4n + 4 15 8 4n + 5 23 16 31 24 7 0 7 0 15 8 4n + 6 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 196 (b) 8-bit data bus width (1/2) <1> access to address (4n) first access second access third access fourth access 7 0 7 0 15 8 4n 23 16 31 24 7 0 7 0 4n + 1 15 8 23 16 31 24 7 0 7 0 4n + 2 15 8 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address <2> access to address (4n + 1) first access second access third access fourth access 7 0 7 0 15 8 4n + 1 23 16 31 24 7 0 7 0 4n + 2 15 8 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 197 (b) 8-bit data bus width (2/2) <3> access to address (4n + 2) first access second access third access fourth access word data external data bus address word data external data bus address word data external data bus address word data external data bus address 7 0 7 0 15 8 4n + 2 23 16 31 24 7 0 7 0 4n + 3 15 8 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 7 0 7 0 4n + 5 15 8 23 16 31 24 <4> access to address (4n + 3) first access second access third access fourth access 7 0 7 0 15 8 4n + 3 23 16 31 24 7 0 7 0 4n + 4 15 8 23 16 31 24 7 0 7 0 4n + 5 15 8 23 16 31 24 7 0 7 0 4n + 6 15 8 23 16 31 24 word data external data bus address word data external data bus address word data external data bus address word data external data bus address
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 198 5.6 wait function 5.6.1 programmable wait function (1) data wait control register 0 (dwc0) to realize interfacing with a low-speed memory or i/o, up to seven data wait states can be inserted in the bus cycle that is executed for each cs space. the number of wait states can be pr ogrammed by using the dwc0 register . immediately after system reset, 7 data wait states are inserted for all the blocks. the dwc0 register can be read or written in 16-bit units. reset sets this register to 7777h. cautions 1. the internal rom and internal ram areas are not subject to programmable wait, and are always accessed without a wait state. the on-ch ip peripheral i/o area is also not subject to programmable wait, and only wait control from each peripheral function is performed. 2. write to the dwc0 register after reset, a nd then do not change the set values. also, do not access an external memory area until the in itial settings of the dwc0 register are complete. after reset: 7777h r/w address: fffff484h 0 0 dwn2 0 0 0 0 1 1 1 1 dwn1 0 0 1 1 0 0 1 1 dwn0 0 1 0 1 0 1 0 1 none 1 2 3 4 5 6 7 dwc0 dw32 dw12 dw31 dw11 dw30 dw10 0 0 dw22 dw02 dw21 dw01 dw20 dw00 8 9 10 11 12 13 number of wait states inserted in csn space (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 caution be sure to clear bits 15, 11, 7, and 3 to ?0?.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 199 5.6.2 external wait function to synchronize an extremely slow external memory, i/o, or asynchronous system, any number of wait states can be inserted in the bus cycle by using the external wait pin (wait). when the pcm0 pin is set to alternate function, the external wait function is enabled. access to each area of the internal rom, internal ram, a nd on-chip peripheral i/o is not subject to control by the external wait function, in the same man ner as the programmable wait function. the wait signal can be input asynchronously to clkout, and is sampled at the falling edge of the clock in the t2 and tw states of the bus cycle in the multiplexed bus mode. in the separate bus mode, it is sampled at the rising edge of the clock immediately after the t1 and tw states of the bus cycle. if the setup/hold time of the sampling timing is not satisfied, a wait state is inserted in the next state, or not inserted at all.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 200 5.6.3 relationship between programm able wait and external wait wait cycles are inserted as the result of an or operation between the wait cycles specifi ed by the set value of the programmable wait and the wait cycles controlled by the wait pin. wait control programmable wait wait via wait pin for example, if the timing of the programmable wait and the wait pin signal is as illustrated below, three wait states will be inserted in the bus cycle. figure 5-3. inserting wait example (a) multiplexed bus clkout t1 t2 tw tw tw t3 wait pin wait via wait pin programmable wait wait control (b) separate bus t1 tw tw tw t2 clkout wait pin wait via wait pin programmable wait wait control remark the circles indicate the sampling timing.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 201 5.6.4 programmable address wait function address-setup or address-hold waits to be inserted in each bus cycle can be set by using the awc register. address wait insertion is set for each chip select area (cs0 to cs3). if an address setup wait is inserted, it seems that the high-clock period of the t1 state is extended by 1 clock. if an address hold wait is inserted, it seems that the low-cl ock period of the t1 state is extended by 1 clock. (1) address wait control register (awc) the awc register can be read or written in 16-bit units. reset sets this register to ffffh. cautions 1. address setup wait and address hold wa it cycles are not inserted when the internal rom area, internal ram area, and on-ch ip peripheral i/o areas are accessed. 2. write to the awc register after reset, a nd then do not change the set values. also, do not access an external memory area until the initial settings of the awc register are complete. after reset: ffffh r/w address: fffff488h 1 ahw3 ahwn 0 1 not inserted inserted awc 1 asw3 1 ahw2 1 asw2 1 ahw1 1 asw1 1 ahw0 1 asw0 8 9 10 11 12 13 specifies insertion of address hold wait (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 aswn 0 1 not inserted inserted specifies insertion of address setup wait (n = 0 to 3) cs0 cs3 cs2 cs1 caution be sure to set bits 15 to 8 to ?1?.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 202 5.7 idle state insertion function to facilitate interfacing with low-speed memories, one idle state (ti) can be inserted a fter the t3 state in the bus cycle that is executed for each space selected by the chip select function in the multiplex address/data bus mode. in the separate bus mode, one idle state (ti) can be inserted after the t2 state. by inserting an idle state, the data output float delay time of the memory can be secured du ring read access (an idle state cannot be inserted during write access). whether the idle state is to be inserted c an be programmed by using the bcc register. an idle state is inserted for all t he areas immediately after system reset. (1) bus cycle control register (bcc) the bcc register can be read or written in 16-bit units. reset sets this register to aaaah. cautions 1. the internal rom, internal ram, a nd on-chip peripheral i/o areas are not subject to idle state insertion. 2. write to the bcc register after reset, and then do not change the set values. also, do not access an external memory area until the initial settings of the bcc register are complete. after reset: aaaah r/w address: fffff48ah 1 bc31 bcn1 0 1 not inserted i nserted bcc 0 0 1 bc21 0 0 1 bc11 0 0 1 bc01 0 0 8 9 10 11 12 13 specifies insertion of idle state (n = 0 to 3) 14 15 1 2 3 4 5 6 7 0 cs0 cs3 cs2 cs1 caution be sure to set bits 15, 13, 11, and 9 to ?1?, and clear bits 14, 12, 10, 8, 6, 4, 2, and 0 to ?0?.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 203 5.8 bus hold function 5.8.1 functional outline the hldrq and hldak functions are valid if the pc m2 and pcm3 pins are set to alternate function. when the hldrq pin is asserted (low level), indicating th at another bus master has requested bus mastership, the external address/data bus goes into a high-impedance state and is released (bus hold status). if the request for the bus mastership is cleared and the hldrq pin is deasserted (high level), driving these pins is started again. during the bus hold period, execution of the program in the internal rom and internal ram is continued until an on-chip peripheral i/o register or t he external memory is accessed. the bus hold status is indicated by assertion of the hldak pin (low level). the bus hold function enables the configuration of mult i-processor type systems in which two or more bus masters exist. note that the bus hold request is not acknowledged during a multiple-acce ss cycle initiated by the bus sizing function or a bit manipulation instruction. status data bus width access type timing at which bus hold request is not acknowledged word access to even address between first and second access between first and second access word access to odd address between second and third access 16 bits halfword access to odd address between first and second access between first and second access between second and third access word access between third and fourth access cpu bus lock 8 bits halfword access between first and second access read-modify-write access of bit manipulation instruction ? ? between read access and write access
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 204 5.8.2 bus hold procedure the bus hold status transition procedure is shown below. <1> hldrq = 0 acknowledged <2> all bus cycle start requests inhibited <3> end of current bus cycle <4> shift to bus idle status <5> hldak = 0 <6> hldrq = 1 acknowledged <7> hldak = 1 <8> bus cycle start request inhibition released <9> bus cycle starts normal status bus hold status normal status hldak (output) hldrq (input) <1> <2> <5> <3><4> <7><8><9> <6> 5.8.3 operation in power save mode because the internal system clock is stopped in the stop , idle1, and idle2 modes, the bus hold status is not entered even if the hldrq pin is asserted. in the halt mode, the hldak pin is asserted as soon as the hldrq pin has been asserted, and the bus hold status is entered. when the hldrq pin is later deassert ed, the hldak pin is also deasserted, and the bus hold status is cleared.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 205 5.9 bus priority bus hold, dma transfer, operand data accesses, instruction fetch (branch), and instruction fetch (successive) are executed in the external bus cycle. bus hold has the highest priority, followed by dma transfer, operand data access, instruction fetch (branch), and instruction fetch (successive). an instruction fetch may be inserted between the read access and write access in a read-modify-write access. if an instruction is executed for two or more accesses, an instruction fetch and bus hold are not inserted between accesses due to bus size limitations. table 5-4. bus priority priority external bus cycle bus master bus hold external device dma transfer dmac operand data access cpu instruction fetch (branch) cpu high low instruction fetch (successive) cpu
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 206 5.10 bus timing figure 5-4. multiplexed bus read timing (bus size: 16 bits, 16-bit access) a1 a2 a3 d1 d2 a3 a2 a1 t1 t2 t3 t1 t2 tw tw t3 ti t1 programmable wait external wait idle state clkout a23 to a16 astb cs3 to cs0 wait ad15 to ad0 rd 8-bit access ad15 to ad8 ad7 to ad0 odd address active hi-z even address hi-z active remark the broken lines indicate high impedance. figure 5-5. multiplexed bus r ead timing (bus size: 8 bits) a1 a2 a3 d1 d2 a3 a2 a1 t1 t2 t3 t1 t2 tw tw t3 ti t1 programmable wait external wait idle state clkout a23 to a16, ad15 to ad8 astb cs3 to cs0 wait ad7 to ad0 rd remark the broken lines indicate high impedance.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 207 figure 5-6. multiplexed bus write timi ng (bus size: 16 bits, 16-bit access) a1 11 00 11 11 00 11 a2 a3 d1 d2 a3 a2 a1 t2 t3 t1 t1 t2 tw tw t3 t1 programmable wait external wait clkout a23 to a16 astb cs3 to cs0 wait ad15 to ad0 wr1, wr0 wr1, wr0 01 10 8-bit access ad15 to ad8 ad7 to ad0 odd address active undefined even address undefined active figure 5-7. multiplexed bus wr ite timing (bus size: 8 bits) a1 11 10 11 11 10 11 a2 a3 d1 d2 a3 a2 a1 t2 t3 t1 t1 t2 tw tw t3 t1 programmable wait external wait clkout a23 to a16, ad15 to ad8 astb cs3 to cs0 wait ad7 to ad0 wr1, wr0
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 208 figure 5-8. multiplexed bus hold timing (bus si ze: 16 bits, 16-bit access) t1 a1 undefined a1 a2 t2 t3 ti note th th th th ti note t1 t2 t3 d1 clkout hldrq hldak a23 to a16 astb cs3 to cs0 ad15 to ad0 rd undefined undefined undefined a2 d2 1111 1111 note this idle state (ti) does not de pend on the bcc register settings. remarks 1. see table 2-2 for the pin statuses in the bus hold mode. 2. the broken lines indicate high impedance.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 209 figure 5-9. separate bus read timi ng (bus size: 16 bits, 16-bit access) t1 a1 a2 a3 t2 t1 tw tw t2 t2 ti t1 d3 d2 programmable wait external wait idle state d1 clkout a23 to a0 cs3 to cs0 wait ad15 to ad0 rd 8-bit access ad15 to ad8 ad7 to ad0 odd address active hi-z even address hi-z active remark the broken lines indicate high impedance. figure 5-10. separate bus r ead timing (bus size: 8 bits) t1 a1 a2 a3 t2 t1 tw tw t2 t2 ti t1 d3 d2 programmable wait external wait idle state d1 clkout a23 to a0 cs3 to cs0 wait ad7 to ad0 rd remark the broken lines indicate high impedance.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 210 figure 5-11. separate bus write timi ng (bus size: 16 bits, 16-bit access) t1 a1 11 00 00 00 11 11 11 11 a2 a3 t2 t1 tw tw t2 t1 t2 d3 d2 programmable wait external wait d1 clkout a23 to a0 cs3 to cs0 wait ad15 to ad0 wr1, wr0 wr1, wr0 01 10 8-bit access ad15 to ad8 ad7 to ad0 odd address active undefined even address undefined active remark the broken lines indicate high impedance. figure 5-12. separate bus writ e timing (bus size: 8 bits) t1 a1 a2 a3 t2 t1 tw tw t2 t1 t2 d3 d2 programmable wait external wait d1 clkout a23 to a0 cs3 to cs0 wait ad7 to ad0 wr1, wr0 11 10 10 10 11 11 11 11 remark the broken lines indicate high impedance.
chapter 5 bus control function preliminary user's manual u17714ej1v0ud 211 figure 5-13. separate bus hold ti ming (bus size: 8 bits, write) clkout t1 t2 a1 d1 d2 undefined a2 undefined 11 11 10 d3 a3 t1 t2 th ti note ti note th th th t1 t2 hldrq hldak a23 to a0 ad7 to ad0 wr1, wr0 cs3 to cs0 11 10 11 10 1111 1111 11 note this idle state (ti) does not de pend on the bcc register settings. remark the broken lines indicate high impedance. figure 5-14. address wait timing (separate bus read, bus size: 16 bits, 16-bit access) tasw t1 tahw t2 clkout astb a23 to a0 cs3 to cs0 wait ad15 to ad0 rd d1 a1 t1 t2 clkout astb a23 to a0 cs3 to cs0 wait ad15 to ad0 rd d1 a1 remarks 1. tasw (address setup wait): image of hi gh-level width of t1 state expanded. 2. tahw (address hold wait): image of lo w-level width of t1 state expanded. 3. the broken lines indicate high impedance.
preliminary user's manual u17714ej1v0ud 212 chapter 6 clock generation function 6.1 overview the following clock generation functions are available. main clock oscillator ? in clock-through mode f x = 2.5 to 10 mhz (f xx = 2.5 to 10 mhz) ? in pll mode f x = 2.5 to 5 mhz ( 4: f xx = 10 to 20 mhz) f x = 2.5 to 4 mhz ( 8: f xx = 20 to 32 mhz) subclock oscillator ? f xt = 32.768 khz multiply ( 4/ 8) function by pll (phase locked loop) ? clock-through mode/pll mode selectable internal oscillator ? f r = 200 khz (typ.) internal system clock generation ? 7 steps (f xx , f xx /2, f xx /4, f xx /8, f xx /16, f xx /32, f xt ) peripheral clock generation clock output function remark f x : main clock oscillation frequency f xx : main clock frequency f xt : subclock frequency f r : internal oscillation clock frequency
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 213 6.2 configuration figure 6-1. clock generator selector selector note frc bit mfrc bit mck bit ck2 to ck0 bits selpll bit pllon bit cls, ck3 bits stop mode subclock oscillator port cm prescaler 1 prescaler 2 idle control halt control halt mode cpu clock watch timer clock timer m clock watch timer clock, watchdog timer 2 clock peripheral clock, watchdog timer 2 clock watchdog timer 2 clock, timer m clock internal system clock prescaler 3 main clock oscillator main clock oscillator stop control rstp bit internal oscillator 1/8 divider xt1 xt2 clkout x1 x2 idle mode pll f xx /32 f xx /16 f xx /8 f xx /4 f xx /2 f xx f cpu f clk f xx to f xx /1,024 f brg = f x /2 to f x /2 12 f xt f xt f xx f x f r f r /8 idle control selector selector note the internal oscillation clock is selected when watchdog timer 2 overflows during the oscillation stabilization time. remark f x : main clock oscillation frequency f xx : main clock frequency f clk : internal system clock frequency f xt : subclock frequency f cpu : cpu clock frequency f brg : watch timer clock frequency f r : internal oscillation clock frequency
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 214 (1) main clock oscillator the main resonator oscillates the following frequencies (f x ). ? in clock-through mode f x = 2.5 to 10 mhz ? in pll mode f x = 2.5 to 5 mhz ( 4) f x = 2.5 to 4 mhz ( 8) (2) subclock oscillator the sub-resonator oscillates a frequency of 32.768 khz (f xt ). (3) main clock oscillator stop control this circuit generates a control signal that stops oscillation of the main clock oscillator. oscillation of the main clock oscillat or is stopped in the stop mode or when the pcc.mck bit = 1 (valid only when the pcc.cls bit = 1). (4) internal oscillator oscillates a frequency (f r ) of 200 khz (typ.). (5) prescaler 1 this prescaler generates the clock (f xx to f xx /1,024) to be supplied to the following on-chip peripheral functions: tmp0 to tmp8, tmq0, tmm0, csib0 to csib5, uarta0 to uarta3, i 2 c00 to i 2 c02, adc, and wdt2 (6) prescaler 2 this circuit divides the main clock (f xx ). the clock generated by prescaler 2 (f xx to f xx /32) is supplied to the selector that generates the cpu clock (f cpu ) and internal system clock (f clk ). f clk is the clock supplied to the intc, rom, and ram blocks, and can be output from the clkout pin. (7) prescaler 3 this circuit divides the clock generated by the main clock oscillator (f x ) to a specific frequency (32.768 khz) and supplies that clock to the watch timer block. for details, see chapter 10 watch timer functions . (8) pll this circuit multiplies the clock generated by the main clock oscillator (f x ) by 4 or 8. it operates in two modes: clock-through mode in which f x is output as is, and pll mode in which a multiplied clock is output. these modes can be sele cted by using the pllctl.selpll bit. whether the clock is multiplied by 4 or 8 is selected by the ckc.ckdiv0 bit, and pl l is started or stopped by the pllctl.pllon bit.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 215 6.3 registers (1) processor clock control register (pcc) the pcc register is a special register. data can be wr itten to this register only in combination of specific sequences (see 3.4.7 special registers ). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 03h.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 216 frc used not used frc 0 1 use of subclock on-chip feedback resistor pcc mck mfrc cls note ck3 ck2 ck1 ck0 oscillation enabled oscillation stopped mck 0 1 main clock oscillator control used not used mfrc 0 1 use of main clock on-chip feedback resistor after reset: 03h r/w address: fffff828h main clock operation subclock operation cls note 0 1 status of cpu clock (f cpu ) even if the mck bit is set (1) while the system is operating with the main clock as the cpu clock, the operation of the main clock does not stop. it stops after the cpu clock has been changed to the subclock. before setting the mck bit from 0 to 1, stop the on-chip peripheral functions operating with the main clock. when the main clock is stopped and the device is operating with the subclock, clear (0) the mck bit and secure the oscillation stabilization time by software before switching the cpu clock to the main clock or operating the on-chip peripheral functions. ?   < > < > < > f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 setting prohibited f xt ck2 0 0 0 0 1 1 1 clock selection (f clk /f cpu ) ck1 0 0 1 1 0 0 1 ck0 0 1 0 1 0 1 ck3 0 0 0 0 0 0 0 1 note the cls bit is a read-only bit. cautions 1. do not change the cpu clock (by using the ck3 to ck0 bits) while clkout is being output. 2. use a bit manipulation instruction to ma nipulate the ck3 bit. when using an 8-bit manipulation instruction, do not change the set values of the ck2 to ck0 bits. remark : don't care
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 217 (a) example of setting main clock operation subclock operation <1> ck3 bit 1: use of a bit manipulation instructi on is recommended. do not change the ck2 to ck0 bits. <2> subclock operation: read the cls bit to check if subclock operation has started. it takes the following time after the ck3 bit is se t until subclock operation is started. max.: 1/f xt (1/subclock frequency) <3> mck bit 1: set the mck bit to 1 only when stopping the main clock. cautions 1. when stopping the ma in clock, stop the pll. also stop the operations of the on-chip peripheral functions operati ng with the main clock. 2. if the following conditions are not satisfi ed, change the ck2 to ck0 bits so that the conditions are satisfied, then change to the subclock operation mode. internal system clock (f clk ) > subclock (f xt : 32.768 khz) 4 remark internal system clock (f clk ): clock generated from the main clock (f xx ) by setting bits ck2 to ck0 [description example] _dma_disable: clrl 0, dchcn[r0] -- dma operation disabled. n = 0 to 3 <1> _set_sub_run : st.b r0, prcmd[r0] set1 3, pcc[r0] -- ck3 bit 1 <2> _check_cls : tst1 4, pcc[r0] -- wait until subclock operation starts. bz _check_cls <3> _stop_main_clock : st.b r0, prcmd[r0] set1 6, pcc[r0] -- mck bit 1, main clock is stopped. _dma_enable: setl 0, dchcn[r0] -- dma operation enabled. n = 0 to 3 remark the description above is simply an example. no te that in <2> above, the cls bit is read in a closed loop.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 218 (b) example of setting subclock operation main clock operation <1> mck bit 0: main clock starts oscillating <2> insert waits by the program and wait until the oscillation stabilizat ion time of the main clock elapses. <3> ck3 bit 0: use of a bit manipulation instruction is recommended. do not change the ck2 to ck0 bits. <4> main clock operation: it takes the following time after the ck3 bit is set until main clock operation is started. max.: 1/f xt (1/subclock frequency) therefore, insert one nop instructi on immediately after setting the ck3 bit to 0 or read the cls bit to check if main clock operation has started. caution enable operation of the on-chip peripher al functions operating with the main clock only after the oscillation of the main clock stabilizes. if their operations are enabled before the lapse of the oscillation stabilizat ion time, a malfunction may occur. [description example] _dma_disable: clrl 0, dchcn[r0] -- dma operation disabled. n = 0 to 3 <1> _start_main_osc : st.b r0, prcmd[r0] -- release of protection of special registers clr1 6, pcc[r0] -- main clock starts oscillating. <2> movea 0x55, r0, r11 -- wait for oscillation stabilization time. _wait_ost : nop nop nop addi -1, r11, r11 cmp r0, r11 bne _wait_ost <3> st.b r0, prcmd[r0] clr1 3, pcc[r0] -- ck3 0 <4> _check_cls : tst1 4, pcc[r0] -- wait until main clock operation starts. bnz _check_cls _dma_enable: setl 0, dchcn[r0] -- dma operation enabled. n = 0 to 3 remark the description above is simply an example. no te that in <4> above, the cls bit is read in a closed loop.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 219 (2) internal oscillati on mode register (rcm) the rcm register is an 8-bit register that sets the operation mode of the internal oscillator. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 rcm 0 0 0 00 0 rstop internal oscillator oscillation internal oscillator stopped rstop 0 1 oscillation/stop of internal oscillator after reset: 00h r/w address: fffff80ch < > cautions 1. the internal oscilla tor cannot be stopped while the cpu is operating on the internal oscillation clock (ccls.cclsf bit = 1). do not set the rstop bit to 1. 2. the internal oscillator o scillates if the ccls.cclsf bit is set to 1 (when wdt overflow occurs during oscillation stabilizat ion) even when the rstop bit is set to 1. at this time, the rstop bit remains being set to 1. (3) cpu operation clock status register (ccls) the ccls register indicates the stat us of the cpu operation clock. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. 0 ccls 0 0 0 0 0 0 cclsf after reset: 00h note r address: fffff82eh operating on main clock (f x ) or subclock (f xt ). operating on internal oscillation clock (f r ). cclsf 0 1 cpu operation clock status note if wdt overflow occurs during oscillation stabilization after a reset is releas ed, the cclsf bit is set to 1 and the reset value is 01h.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 220 6.4 operation 6.4.1 operation of each clock the following table shows the oper ation status of each clock. table 6-1. operation status of each clock pcc register clk bit = 0, mck bit = 0 cls bit = 1, mck bit = 0 cls bit = 1, mck bit = 1 register setting and operation status target clock during reset during oscillation stabilization time count halt mode idle1, idle2 mode stop mode subclock mode sub-idle mode subclock mode sub-idle mode main clock oscillator (f x ) subclock oscillator (f xt ) cpu clock (f cpu ) internal system clock (f clk ) main clock (in pll mode, f xx ) note peripheral clock (f xx to f xx /1,024) wt clock (main) wt clock (sub) wdt2 clock (internal oscillation) wdt2 clock (main) wdt2 clock (sub) note lockup time remark : operable : stopped 6.4.2 clock output function the clock output function is used to output the internal system clock (f clk ) from the clkout pin. the internal system clock (f clk ) is selected by using the pcc.ck3 to pcc.ck0 bits. the clkout pin functions alte rnately as the pcm1 pin and functions as a clock output pin if so specified by the control register of port cm. the status of the clko ut pin is the same as the in ternal system clock in table 6-1 and the pin can output the clock when it is in the operable status. it outputs a low level in the stopped stat us. however, the clkout pin is in the port mode (pcm1 pin: input mode) after reset and until it is set in the output mode. ther efore, the stat us of the pin is hi-z.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 221 6.5 pll function 6.5.1 overview in the v850es/jj2, an operating clock that is 4 or 8 time s higher than the oscillation frequency output by the pll function or the clock-through mode can be selected as the operating clock of the cpu and on-chip peripheral functions. when pll function is used ( 4): input clock = 2.5 to 5 mhz (output: 10 to 20 mhz) clock-through mode: input clock = 2.5 to 10 mhz (output: 2.5 to 10 mhz) 6.5.2 registers (1) pll control register (pllctl) the pllctl register is an 8-bit regi ster that controls the pll function. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 01h. 0 pllctl 0 0 0 00 selpll pllon pll stopped pll operating (after pll operation starts, a lockup time is required for frequency stabilization) pllon 0 1 pll operation stop register clock-through mode pll mode selpll 0 1 cpu operation clock selection register after reset: 01h r/w address: fffff82ch < > < > cautions 1. when the pllon bit is cleared to 0, the selpll bit is automatically cleared to 0 (clock- through mode). 2. the selpll bit can be set to 1 only when the pll clock frequency is stabilized. if not (unlocked), "0" is written to the sel pll bit if data is written to it.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 222 (2) clock control register (ckc) the ckc register is a special register. data can be wri tten to this register only in a combination of specific sequence (see 3.4.7 special registers ). the ckc register controls the inte rnal system clock in the pll mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 0ah. 0 ckc 0 0 0 1 0 1 ckdiv0 after reset: 0ah r/w address: fffff822h f xx = 4 f x (f x = 2.5 to 5.0 mhz) f xx = 8 f x (f x = 2.5 to 4.0 mhz) ckdiv0 0 1 internal system clock (f xx ) in pll mode cautions 1. the pll mode cannot be used at f x = 5.0 to 10.0 mhz. 2. before changing the multip lication factor between 4 and 8 by using the ckc register, set the clock-through mode and stop the pll. 3. be sure to set bits 3 and 1 to ?1 ? and clear bits 7 to 4 and 2 to ?0?. remark both the cpu clock and peripheral clock are divided by the ckc register, but only the cpu clock is divided by the pcc register.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 223 (3) lock register (lockr) phase lock occurs at a given frequency following powe r application or immediately after the stop mode is released, and the time required for stabilization is the lockup time (frequency stabilization time). this state until stabilization is called the lock up status, and the stabilized state is called the locked status. the lockr register includes a lock bit that re flects the pll frequency stabilization status. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. 0 lockr 0 0 0 00 0 lock locked status unlocked status lock 0 1 pll lock status check after reset: 00h r address: fffff824h < > caution the lock register does not reflect the lock status of the p ll in real time. the set/clear conditions are as follows. [set conditions] ? upon system reset note ? in idle2 or stop mode ? upon setting of pll stop (clearing of pllctl.pllon bit to 0) ? upon stopping main clock and using cpu with subc lock (setting of pcc.ck3 bit to 1 and setting of pcc.mck bit to 1) note this register is set to 01h by reset and cleared to 00h after the reset has been released and the oscillation stabilization time has elapsed. [clear conditions] ? upon overflow of oscillation stabilization time fo llowing reset release (osts register default time (see 21.2 (3) oscillation stabilization time select register (osts) )) ? upon oscillation stabilization timer overflow (tim e set by osts register) following stop mode release, when the stop mode was set in the pll operating status ? upon pll lockup time timer overflow (time set by plls register) when the pllctl.pllon bit is changed from 0 to 1 ? after the setup time inserted upon release of the id le2 mode is released (time set by the osts register) when the idle2 mode is set during pll operation.
chapter 6 clock generation function preliminary user's manual u17714ej1v0ud 224 (4) pll lockup time specification register (plls) the plls register is an 8-bit register used to sele ct the pll lockup time when the pllctl.pllon bit is changed from 0 to 1. this register can be read or written in 8-bit units. reset sets this register to 03h. 0 2 10 /f x 2 11 f x 2 12 /f x 2 13 /f x (default value) plls1 0 0 1 1 plls0 0 1 0 1 selection of pll lockup time plls 0 0 0 0 0 plls1 plls0 after reset: 03h r/w address: fffff6c1h cautions 1. set so that the lockup time is 800 s or longer. 2. do not change the plls regi ster setting during the lockup period. 6.5.3 usage (1) when pll is used ? after the reset signal has been released, the pll operates (pllctl.pllon bit = 1), but because the default mode is the clock-through mode (pllctl.selpll bi t = 0), select the pll mode (selpll bit = 1). ? to enable pll operation, first set the pllon bit to 1, and then set the selpll bit to 1 after the lockr.lock bit = 0. to stop the pll, first select the clock-through mode (selpll bit = 0), wait for 8 clocks or more, and then stop the pll (pllon bit = 0). ? the pll stops during transition to the idle2 or stop mode regardless of the setting and is restored from the idle2 or stop mode to the status before transition. the time required for restoration is as follows. (a) when transiting to the idle2 or st op mode from the clock through mode ? stop mode: set the osts register so that the o scillation stabilization time is 1 ms (min.) or longer. ? idle2 mode: set the osts register so that the setup time is 350 s (min.) or longer. (b) when transiting to the idle 2 or stop m ode while remaining in the pll operation mode ? stop mode: set the osts register so that the o scillation stabilization time is 1 ms (min.) or longer. ? idle2 mode: set the osts register so that the setup time is 800 s (min.) or longer. when transiting to the idle1 mode, the pll does not stop. stop the pll if necessary. (2) when pll is not used ? the clock-through mode (selpll bit = 0) is selected a fter the reset signal has been released, but the pll is operating (pllon bit = 1) and must t herefore be stopped (pllon bit = 0).
preliminary user's manual u17714ej1v0ud 225 chapter 7 16-bit timer/event counter p (tmp) timer p (tmp) is a 16-bit timer/event counter. the v850es/jj2 has nine timer/event counter channels, tmp0 to tmp8. 7.1 overview an outline of tmpn is shown below. ? clock selection: 8 ways ? capture/trigger input pins: 2 ? external event count input pins: 1 ? external trigger input pins: 1 ? timer/counters: 1 ? capture/compare registers: 2 ? capture/compare match interrupt request signals: 2 ? timer output pins: 2 remark n = 0 to 8 7.2 functions tmpn has the following functions. ? interval timer ? external event counter ? external trigger pulse output ? one-shot pulse output ? pwm output ? free-running timer ? pulse width measurement remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 226 7.3 configuration tmpn includes the following hardware. table 7-1. configuration of tmpn item configuration timer register 16-bit counter registers tmpn capture/compare registers 0, 1 (tpnccr0, tpnccr1) tmpn counter read buffer register (tpncnt) ccr0, ccr1 buffer registers timer inputs 2 (tipn0 note 1 , tipn1 pins) timer outputs 2 (topn0, topn1 pins) control registers note 2 tmpn control registers 0, 1 (tpnctl0, tpnctl1) tmpn i/o control registers 0 to 2 (tpnioc0 to tpnioc2) tmpn option register 0 (tpnopt0) notes 1. the tipn0 pin functions alternately as a capt ure trigger input signal, external event count input signal, and external trigger input signal. 2. when using the functions of the tip n0, tipn1,topn0, and topn1 pins, see table 4-19 using port pin as alternate-function pin . remark n = 0 to 8 figure 7-1. block diagram of tmpn f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 note 1 , f xx /256 note 2 f xx /128 note 1 , f xx /512 note 2 selector internal bus internal bus topn0 topn1 tipn0 tipn1 selector edge detector ccr0 buffer register ccr1 buffer register tpnccr0 tpnccr1 16-bit counter tpncnt inttpnov inttpncc0 inttpncc1 output controller clear notes 1. tmp0, tmp2, tmp4, tmp6, tmp8 2. tmp1, tmp3, tmp5, tmp7 remark f xx : main clock frequency
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 227 (1) 16-bit counter this 16-bit counter can count inte rnal clocks or external events. the count value of this counter can be read by using the tpncnt register. when the tpnctl0.tpnce bit = 0, the va lue of the 16-bit counter is ffffh. if the tpncnt register is read at this time, 0000h is read. reset sets the tpnce bit to 0. therefor e, the 16-bit counter is set to ffffh. (2) ccr0 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tpnccr0 register is used as a compare regist er, the value written to the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttpncc0) is generated. the ccr0 buffer register cannot be read or written directly. the ccr0 buffer register is cleared to 0000h after reset, as the tpnccr0 register is cleared to 0000h. (3) ccr1 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tpnccr1 register is used as a compare regist er, the value written to the tpnccr1 register is transferred to the ccr1 buffer register. when the count value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttpncc1) is generated. the ccr1 buffer register cannot be read or written directly. the ccr1 buffer register is cleared to 0000h after reset, as the tpnccr1 register is cleared to 0000h. (4) edge detector this circuit detects the valid edges input to the tipn0 and tipn1 pins. no edge, rising edge, falling edge, or both the rising and falling edges can be selected as the valid edge by using the tpnioc1 and tpnioc2 registers. (5) output controller this circuit controls the output of the topn0 and topn 1 pins. the output contro ller is controlled by the tpnioc0 register. (6) selector this selector selects the count clock for the 16-bit counter . eight types of internal clocks or an external event can be selected as the count clock.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 228 7.4 registers the registers that control tmpn are as follows. ? tmpn control register 0 (tpnctl0) ? tmpn control register 1 (tpnctl1) ? tmpn i/o control register 0 (tpnioc0) ? tmpn i/o control register 1 (tpnioc1) ? tmpn i/o control register 2 (tpnioc2) ? tmpn option register 0 (tpnopt0) ? tmpn capture/compare register 0 (tpnccr0) ? tmpn capture/compare register 1 (tpnccr1) ? tmpn counter read buffer register (tpncnt) remarks 1. when using the functions of the tipn0, tipn1,to pn0, and topn1 pins, see table 4-19 using port pin as alternate-function pin . 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 229 (1) tmpn control register 0 (tpnctl0) the tpnctl0 register is an 8-bit register that controls the operation of tmpn. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tpnctl0 register by software. tpnce tmpn operation disabled (tmpn reset asynchronously note ). tmpn operation enabled. tmpn operation started. tpnce 0 1 tmpn operation control tpnctl0 (n = 0 to 8) 0 0 0 0 tpncks2 tpncks1 tpncks0 654321 after reset: 00h r/w address: tp0ctl0 fffff590h, tp1ctl0 fffff5a0h, tp2ctl0 fffff5b0h, tp3ctl0 fffff5c0h, tp4ctl0 fffff5d0h, tp5ctl0 fffff5e0h, tp6ctl0 fffff5f0h, tp7ctl0 fffff600h, tp8ctl0 fffff610h <7> 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 tpncks2 0 0 0 0 1 1 1 1 internal count clock selection n = 0, 2, 4, 6, 8 n = 1, 3, 5, 7 tpncks1 0 0 1 1 0 0 1 1 tpncks0 0 1 0 1 0 1 0 1 note tpn0pt0.tpnovf bit, 16-bit counter, timer output (topn0, topn1 pins) cautions 1. set the tpncks2 to tpncks0 bits when the tpnce bit = 0. when the value of the tpnce bi t is changed from 0 to 1, the tpncks2 to tpncks0 bits can be set simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency (2) tmpn control register 1 (tpnctl1) the tpnctl1 register is an 8-bit register that controls the operation of tmpn. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 230 0 tpnest 0 1 software trigger control tpnctl1 (n = 0 to 8) tpnest tpneee 0 0 tpnmd2 tpnmd1 tpnmd0 <6> <5> 4 3 2 1 after reset: 00h r/w address: tp0ctl1 fffff591h, tp1ctl1 fffff5a1h, tp2ctl1 fffff5b1h, tp3ctl1 fffff5c1h, tp4ctl1 fffff5d1h, tp5ctl1 fffff5e1h, tp6ctl1 fffff5f1h, tp7ctl1 fffff601h, tp8ctl1 fffff611h generate a valid signal for external trigger input. ? in one-shot pulse output mode: a one-shot pulse is output with writing 1 to the tpnest bit as the trigger. ? in external trigger pulse output mode: a pwm waveform is output with writing 1 to the tpnest bit as the trigger. disable operation with external event count input. (perform counting with the count clock selected by the tpnctl0.tpnck0 to tpnck2 bits.) tpneee 0 1 count clock selection the tpneee bit selects whether counting is performed with the internal count clock or the valid edge of the external event count input. 7 0 interval timer mode external event count mode external trigger pulse output mode one-shot pulse output mode pwm output mode free-running timer mode pulse width measurement mode setting prohibited tpnmd2 0 0 0 0 1 1 1 1 timer mode selection tpnmd1 0 0 1 1 0 0 1 1 tpnmd0 0 1 0 1 0 1 0 1 enable operation with external event count input. (perform counting at the valid edge of the external event count input signal.) ? cautions 1. the tpnest bit is valid only in the external trigger pulse output mode or one-shot pulse output mode . in any other mode, writing 1 to this bit is ignored. 2. external event count input is selected in the external event count mode regardless of the value of the tpneee bit. 3. set the tpneee and tpnmd2 to tpnmd0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) the operation is not guaranteed when rewriting is performed with the tpnce bit = 1. if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 4. be sure to clear bits 3, 4, and 7 to ?0?.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 231 (3) tmpn i/o control register 0 (tpnioc0) the tpnioc0 register is an 8-bit register that controls the timer output (topn0, topn1 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnol1 0 1 topn1 pin output level setting topn1 pin output inversion disabled topn1 pin output inversion enabled tpnioc0 (n = 0 to 8) 0 0 0 tpnol1 tpnoe1 tpnol0 tpnoe0 6543<2>1 after reset: 00h r/w address: tp0ioc0 fffff592h, tp1ioc0 fffff5a2h, tp2ioc0 fffff5b2h, tp3ioc0 fffff5c2h, tp4ioc0 fffff5d2h, tp5ioc0 fffff5e2h, tp6ioc0 fffff5f2h, tp7ioc0 fffff602h, tp8ioc0 fffff612h tpnoe1 0 1 topn1 pin output setting timer output disabled ? when tpnol1 bit = 0: low level is output from the topn1 pin ? when tpnol1 bit = 1: high level is output from the topn1 pin tpnol0 0 1 topn0 pin output level setting topn0 pin output inversion disabled topn0 pin output inversion enabled tpnoe0 0 1 topn0 pin output setting timer output disabled ? when tpnol0 bit = 0: low level is output from the topn0 pin ? when tpnol0 bit = 1: high level is output from the topn0 pin 7 <0> timer output enabled (a square wave is output from the topn1 pin). timer output enabled (a square wave is output from the topn0 pin). cautions 1. rewrite the tpnol1, tpnoe1, tpnol0, and tpnoe0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. even if the tpnolm bit is manipulated when the tpnce and tpnoem bits are 0, the topnm pin output level varies (m = 0, 1).
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 232 (4) tmpn i/o control register 1 (tpnioc1) the tpnioc1 register is an 8-bit regist er that controls the valid edge of the capture trig ger input signals (tipn0, tipn1 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnis3 0 0 1 1 tpnis2 0 1 0 1 capture trigger input signal (tipn1 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tpnioc1 (n = 0 to 8) 0 0 0 tpnis3 tpnis2 tpnis1 tpnis0 654321 after reset: 00h r/w address: tp0ioc1 fffff593h, tp1ioc1 fffff5a3h, tp2ioc1 fffff5b3h, tp3ioc1 fffff5c3h, tp4ioc1 fffff5d3h, tp5ioc1 fffff5e3h, tp6ioc1 fffff5f3h, tp7ioc1 fffff603h, tp8ioc1 fffff613h tpnis1 0 0 1 1 tpnis0 0 1 0 1 capture trigger input signal (tipn0 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tpnis3 to tpnis0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. the tpnis3 to tpnis0 bits are valid only in the free- running timer mode and the pulse width measurement mode. in all other modes, a capture operation is not possible.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 233 (5) tmpn i/o control register 2 (tpnioc2) the tpnioc2 register is an 8-bit register that controls the valid edge of the external event count input signal (tipn0 pin) and external trigger input signal (tipn0 pin). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnees1 0 0 1 1 tpnees0 0 1 0 1 external event count input signal (tipn0 pin) valid edge setting no edge detection (external event count invalid) detection of rising edge detection of falling edge detection of both edges tpnioc2 (n = 0 to 8) 0 0 0 tpnees1 tpnees0 tpnets1 tpnets0 654321 after reset: 00h r/w address: tp0ioc2 fffff594h, tp1ioc2 fffff5a4h, tp2ioc2 fffff5b4h, tp3ioc2 fffff5c4h, tp4ioc2 fffff5d4h, tp5ioc2 fffff5e4h, tp6ioc2 fffff5f4h, tp7ioc2 fffff604h, tp8ioc2 fffff614h tpnets1 0 0 1 1 tpnets0 0 1 0 1 external trigger input signal (tipn0 pin) valid edge setting no edge detection (external trigger invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tpnees1, tpnees0, tpnets1, and tpnets0 bits when the tpnctl0.tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mistakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. the tpnees1 and tpnees0 bits are valid only when the tpnctl1.tpneee bit = 1 or when the external event count mode (tpnctl1.tpnmd 2 to tpnctl1.tpnmd0 bits = 001) has been set. 3. the tpnets1 and tpnets0 bits are valid only when the external trigger pulse output mode (tpnctl1.tpnmd2 to tpnctl1.tpnmd0 bits = 010) or the one-shot pulse output mode (tpnctl1.tpn md2 to tpnctl1.tpnmd0 = 011) is set.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 234 (6) tmpn option register 0 (tpnopt0) the tpnopt0 register is an 8-bit register used to set the capture/compare operation and detect an overflow. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tpnccs1 0 1 tpnccr1 register capture/compare selection the tpnccs1 bit setting is valid only in the free-running timer mode. compare register selected capture register selected tpnopt0 (n = 0 to 8) 0 tpnccs1 tpnccs0 0 0 0 tpnovf 654321 after reset: 00h r/w address: tp0opt0 fffff595h, tp1opt0 fffff5a5h, tp2opt0 fffff5b5h, tp3opt0 fffff5c5h, tp4opt0 fffff5d5h, tp5opt0 fffff5e5h, tp6opt0 fffff5f5h, tp7opt0 fffff605h, tp8opt0 fffff615h tpnccs0 0 1 tpnccr0 register capture/compare selection the tpnccs0 bit setting is valid only in the free-running timer mode. compare register selected capture register selected tpnovf set (1) reset (0) tmpn overflow detection flag ?the tpnovf bit is reset when the 16-bit counter count value overflows from ffffh to 0000h in the free-running timer mode or the pulse width measurement mode. ?an interrupt request signal (inttpnov) is generated at the same time that the tpnovf bit is set to 1. the inttpnov signal is not generated in modes other than the free-running timer mode and the pulse width measurement mode. ?the tpnovf bit is not cleared even when the tpnovf bit or the tpnopt0 register are read when the tpnovf bit = 1. ?the tpnovf bit can be both read and written, but the tpnovf bit cannot be set to 1 by software. writing 1 has no influence on the operation of tmpn. overflow occurred tpnovf bit 0 written or tpnctl0.tpnce bit = 0 7 <0> cautions 1. rewrite the tpnccs1 and tpnccs0 bits when the tpnce bit = 0. (the same value can be written when the tpnce bit = 1.) if rewriting was mi stakenly performed, clear the tpnce bit to 0 and then set the bits again. 2. be sure to clear bits 1 to 3, 6, and 7 to ?0?.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 235 (7) tmpn capture/compare register 0 (tpnccr0) the tpnccr0 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tpnopt0.tpnccs0 bit. in the pulse width measurement mode, the tpnccr0 register can be used only as a capt ure register. in any other mode, this register can be used only as a compare register. the tpnccr0 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tpnccr0 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tpnccr0 (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r/w address: tp0ccr0 fffff596h, tp1ccr0 fffff5a6h, tp2ccr0 fffff5b6h, tp3ccr0 fffff5c6h, tp4ccr0 fffff5d6h, tp5ccr0 fffff5e6h, tp6ccr0 fffff5f6h, tp7ccr0 fffff606h, tp8ccr0 fffff616h 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 236 (a) function as compare register the tpnccr0 register can be rewritten even when the tpnctl0.tpnce bit = 1. the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttpncc0) is generated. if topn0 pin output is ena bled at this time, the output of the topn0 pin is inverted. when the tpnccr0 register is used as a cycle register in the interval timer mode, external event count mode, external trigger pulse output mode, one-shot pulse output mode, or pwm output mode, the value of the 16-bit counter is cleared (0000h) if its count va lue matches the value of the ccr0 buffer register. (b) function as capture register when the tpnccr0 register is used as a capture regi ster in the free-running timer mode, the count value of the 16-bit counter is stored in the tpnccr0 register if the valid ed ge of the capture trigger input pin (tipn0 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tpnccr0 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tipn0) is detected. even if the capture operation and reading the tpn ccr0 register conflict, the correct value of the tpnccr0 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 7-2. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 237 (8) tmpn capture/compare register 1 (tpnccr1) the tpnccr1 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tpnopt0.tpnccs1 bit. in the pulse width measurement mode, the tpnccr1 register can be used only as a capt ure register. in any other mode, this register can be used only as a compare register. the tpnccr1 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tpnccr1 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tpnccr1 (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r/w address: tp0ccr1 fffff598h, tp1ccr1 fffff5a8h, tp2ccr1 fffff5b8h, tp3ccr1 fffff5c8h, tp4ccr1 fffff5d8h, tp5ccr1 fffff5e8h, tp6ccr1 fffff5f8h, tp7ccr1 fffff608h, tp8ccr1 fffff618h 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 238 (a) function as compare register the tpnccr1 register can be rewritten even when the tpnctl0.tpnce bit = 1. the set value of the tpnccr1 register is transferred to the ccr1 buffer register. when the value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttpncc1) is generated. if topn1 pin output is ena bled at this time, the output of the topn1 pin is inverted. (b) function as capture register when the tpnccr1 register is used as a capture regi ster in the free-running timer mode, the count value of the 16-bit counter is stored in the tpnccr1 register if the valid ed ge of the capture trigger input pin (tipn1 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tpnccr1 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tipn1) is detected. even if the capture operation and reading the tpn ccr1 register conflict, the correct value of the tpnccr1 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 7-3. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 239 (9) tmpn counter read bu ffer register (tpncnt) the tpncnt register is a read buffer register that can read the count va lue of the 16-bit counter. if this register is read when the tpnctl0.tpnce bit = 1, the count value of the 16-bit timer can be read. this register is read-only, in 16-bit units. the value of the tpncnt register is cleared to 0000h wh en the tpnce bit = 0. if t he tpncnt register is read at this time, the value of the 16-bit count er (ffffh) is not read, but 0000h is read. the value of the tpncnt register is cleared to 000 0h after reset, as the tpnce bit is cleared to 0. caution accessing the tpncnt register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tpncnt (n = 0 to 8) 12 10 8 6 4 2 after reset: 0000h r address: tp0cnt fffff59ah, tp1cnt fffff5aah, tp2cnt fffff5bah, tp3cnt fffff5cah, tp4cnt fffff5dah, tp5cnt fffff5eah, tp6cnt fffff5fah, tp7cnt fffff60ah, tp8cnt fffff61ah 14 0 13 11 9 7 5 3 15 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 240 7.5 operation tmpn can perform the following operations. operation tpnctl1.tpnest bit (software trigger bit) tipn0 pin (external trigger input) capture/compare register setting compare register write interval timer mode invalid invalid compare only anytime write external event count mode note 1 invalid invalid compare only anytime write external trigger pulse output mode note 2 valid valid compare only batch write one-shot pulse output mode note 2 valid valid compare only anytime write pwm output mode invalid invalid compare only batch write free-running timer mode invalid invalid switching enabled anytime write pulse width measurement mode note 2 invalid invalid capture only not applicable notes 1. to use the external event count mode, specify that t he valid edge of the tipn0 pin capture trigger input is not detected (by clearing the tpnioc1.tpnis1 and tpnioc1.tpnis0 bits to "00"). 2. when using the external trigger pulse output m ode, one-shot pulse output mode, and pulse width measurement mode, select the internal clock as the count clock (by clearing the tpnctl1.tpneee bit to 0). remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 241 7.5.1 interval timer mode (t pnmd2 to tpnmd0 bits = 000) in the interval timer mode, an interrupt request signal (inttpncc0) is generated at t he specified interval if the tpnctl0.tpnce bit is set to 1. a square wave whose hal f cycle is equal to the interval can be output from the topn0 pin. usually, the tpnccr1 register is not used in the interval timer mode. figure 7-2. configuration of interval timer 16-bit counter output controller ccr0 buffer register tpnce bit tpnccr0 register count clock selection clear match signal topn0 pin inttpncc0 signal remark n = 0 to 8 figure 7-3. basic timing of operation in interval timer mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal d 0 d 0 d 0 d 0 d 0 interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 242 when the tpnce bit is set to 1, the va lue of the 16-bit counter is cleared fr om ffffh to 0000h in synchronization with the count clock, and t he counter starts counting. at this time, the out put of the topn0 pin is inverted. additionally, the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer register, the 16-bit counter is cleared to 0000h, the output of the topn0 pin is in verted, and a compare match interrupt request signal (inttpncc0) is generated. the interval can be calculated by the following expression. interval = (set value of tpnccr0 register + 1) count clock cycle remark n = 0 to 8 figure 7-4. register setting for in terval timer mode operation (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0 0/1 note 00 tpnctl1 0, 0, 0: interval timer mode 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count with external event count input signal 000 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest note this bit can be set to 1 only when the interrupt request signals (inttpncc0 and inttpncc1) are masked by the interrupt mask flags (tpnccmk0 and tpnccmk1) and timer output (topn1) is performed at the same time. however, set the tp nccr0 and tpnccr1 registers to the same value (see 7.5.1 (2) (d) operati on of tpnccr1 register ).
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 243 figure 7-4. register setting for in terval timer mode operation (2/2) (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of output level with operation of topn0 pin disabled 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting of output level with operation of topn1 pin disabled 0: low level 1: high level 0/1 0/1 0/1 tpnoe1 tpnol0 tpnoe0 tpnol1 (d) tmpn counter read bu ffer register (tpncnt) by reading the tpncnt register, the count va lue of the 16-bit counter can be read. (e) tmpn capture/compare register 0 (tpnccr0) if the tpnccr0 register is set to d 0 , the interval is as follows. interval = (d 0 + 1) count clock cycle (f) tmpn capture/compare register 1 (tpnccr1) usually, the tpnccr1 register is not used in the inte rval timer mode. however, the set value of the tpnccr1 register is transferred to the ccr1 buffer register. a compare match interrupt request signal (inttpncc1) is generated when the count value of th e 16-bit counter matches the value of the ccr1 buffer register. therefore, mask the interrupt request by using the corresponding interrupt mask flag (tpnccmk1). remarks 1. tmpn i/o control register 1 (tpnioc1), tmpn i/o control register 2 (tpnioc2), and tmpn option register 0 (tpnopt0) are not used in the interval timer mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 244 (1) interval timer mode operation flow figure 7-5. software processing flow in interval timer mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal d 0 d 0 d 0 d 0 <1> <2> tpnce bit = 1 tpnce bit = 0 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnccr0 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). the counter is initialized and counting is stopped by clearing the tpnce bit to 0. start stop <1> count operation start flow <2> count operation stop flow remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 245 (2) interval timer mode operation timing (a) operation if tpnccr0 re gister is set to 0000h if the tpnccr0 register is set to 0000h, the inttpncc0 signal is generated at each count clock subsequent to the first count clock, and t he output of the topn0 pin is inverted. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal 0000h interval time count clock cycle interval time count clock cycle ffffh 0000h 0000h 0000h 0000h remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 246 (b) operation if tpnccr0 register is set to ffffh if the tpnccr0 register is set to ffffh, the 16-bit co unter counts up to ffffh. t he counter is cleared to 0000h in synchronization with the next count-up timing. the inttpncc0 signal is generated and the output of the topn0 pin is inverted. at this time, an overflow interrupt request signal (inttpnov) is not generated, nor is the overflow flag (tpnopt0.tpnovf bit) set to 1. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal ffffh interval time 10000h count clock cycle interval time 10000h count clock cycle interval time 10000h count clock cycle remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 247 (c) notes on rewriting tpnccr0 register to change the value of the tpnccr0 register to a smaller value, stop counting once and then change the set value. if the value of the tpnccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register tpnol0 bit topn0 pin output inttpncc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 l interval time (1) interval time (ng) interval time (2) remarks 1. interval time (1): (d 1 + 1) count clock cycle interval time (ng): (10000h + d 2 + 1) count clock cycle interval time (2): (d 2 + 1) count clock cycle 2. n = 0 to 8 if the value of the tpnccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buffer register as soon as the tpnccr0 register has been rewritten. consequently, the value of the 16-bit counter that is compared is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttpncc0 signal is generated and the output of the topn0 pin is inverted. therefore, the inttpncc0 signal may not be generated at the interval time "(d 1 + 1) count clock cycle" or "(d 2 + 1) count clock cycle" originally expected, but may be generated at an interval of "(10000h + d 2 + 1) count clock period".
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 248 (d) operation of tpnccr1 register figure 7-6. configuration of tpnccr1 register ccr0 buffer register tpnccr0 register tpnccr1 register ccr1 buffer register topn0 pin inttpncc0 signal topn1 pin inttpncc1 signal 16-bit counter output controller tpnce bit count clock selection clear match signal output controller match signal remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 249 if the set value of the tpnccr1 register is less than the set value of the tpnccr0 register, the inttpncc1 signal is generated once per cycle. at the same time, the output of t he topn1 pin is inverted. the topn1 pin outputs a square wave with the sa me cycle as that output by the topn0 pin. figure 7-7. timing chart when d 01 d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal tpnccr1 register topn1 pin output inttpncc1 signal d 01 d 11 d 01 d 11 d 11 d 11 d 11 d 01 d 01 d 01 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 250 if the set value of the tpnccr1 register is greater than the set value of the tpnccr0 register, the count value of the 16-bit counter does not match the va lue of the tpnccr1 register. consequently, the inttpncc1 signal is not generated, nor is the output of the topn1 pin changed. figure 7-8. timing chart when d 01 < d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register topn0 pin output inttpncc0 signal tpnccr1 register topn1 pin output inttpncc1 signal d 01 d 11 d 01 d 01 d 01 d 01 l remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 251 7.5.2 external event count mode (tpnmd2 to tpnmd0 bits = 001) in the external event count mode, the valid edge of the external event count input is counted when the tpnctl0.tpnce bit is set to 1, and an interrupt request si gnal (inttpncc0) is generated each time the specified number of edges have been counted . the topn0 pin cannot be used. usually, the tpnccr1 register is not us ed in the external event count mode. figure 7-9. configuration in external event count mode 16-bit counter ccr0 buffer register tpnce bit tpnccr0 register edge detector clear match signal inttpncc0 signal tipn0 pin (external event count input) remark n = 0 to 8 figure 7-10. basic timing in external event count mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 0 d 0 d 0 d 0 16-bit counter tpnccr0 register inttpncc0 signal external event count input (tipn0 pin input) d 0 external event count interval (d 0 + 1) d 0 ? 1d 0 0000 0001 external event count interval (d 0 + 1) external event count interval (d 0 + 1) remarks 1. this figure shows the basic timing when the ri sing edge is specified as the valid edge of the external event count input. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 252 when the tpnce bit is set to 1, the value of the 16-bit counter is clea red from ffffh to 0000h. the counter counts each time the valid edge of external event count input is detected. additionally, the set value of the tpnccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer register, the 16-bit counter is cleared to 0000h, and a compare match interrupt request signal (inttpncc0) is generated. the inttpncc0 signal is generated each time the valid e dge of the external event count input has been detected (set value of tpnccr0 register + 1) times. figure 7-11. register setting for operati on in external event count mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 0: stop counting 1: enable counting 000 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 00000 tpnctl1 0, 0, 1: external event count mode 001 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest (c) tmpn i/o control register 0 (tpnioc0) 00000 tpnioc0 0: disable topn0 pin output 0: disable topn1 pin output 000 tpnoe1 tpnol0 tpnoe0 tpnol1 (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 253 figure 7-11. register setting for operati on in external event count mode (2/2) (e) tmpn counter read bu ffer register (tpncnt) the count value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register 0 (tpnccr0) if d 0 is set to the tpnccr0 register, the counter is cleared and a compare match interrupt request signal (inttpncc0) is generated when the nu mber of external event counts reaches (d 0 + 1). (g) tmpn capture/compare register 1 (tpnccr1) usually, the tpnccr1 register is not used in the exte rnal event count mode. however, the set value of the tpnccr1 register is transferred to the ccr1 buff er register. when the count value of the 16-bit counter matches the value of the ccr1 buffer re gister, a compare match interrupt request signal (inttpncc1) is generated. therefore, mask the interrupt signal by using the interrupt mask flag (tpnccmk1). remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the external event count mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 254 (1) external event count mode operation flow figure 7-12. flow of software processing in external event count mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 0 d 0 d 0 d 0 <1> <2> tpnce bit = 1 tpnce bit = 0 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). the counter is initialized and counting is stopped by clearing the tpnce bit to 0. start stop <1> count operation start flow <2> count operation stop flow remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 255 (2) operation timing in external event count mode cautions 1. in the external event count mode , do not set the tpnccr0 register to 0000h. 2. in the external event count mode, use of th e timer output is disabled. if performing timer output using external event co unt input, set the interval timer mode, and select the operation enabled by the external e vent count input fo r the count clock (tpnctl1.tpnmd2 to tpnctl1.tpnmd0 bi ts = 000, tpnctl1.tpneee bit = 1). (a) operation if tpnccr0 register is set to ffffh if the tpnccr0 register is set to ffffh, the 16-bit co unter counts to ffffh each time the valid edge of the external event count signal has been detected. the 16-bit counter is cleared to 0000h in synchronization with the next count-up timing, and the inttpncc0 signal is generated. at this time, the tpnopt0.tpnovf bit is not set. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal ffffh external event count signal interval external event count signal interval external event count signal interval remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 256 (b) notes on rewriting the tpnccr0 register to change the value of the tpnccr0 register to a smaller value, stop counting once and then change the set value. if the value of the tpnccr0 register is rewritten to a smaller value during counting, the 16-bit counter may overflow. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 external event count signal interval (1) (d 1 + 1) external event count signal interval (ng) (10000h + d 2 + 1) external event count signal interval (2) (d 2 + 1) remark n = 0 to 8 if the value of the tpnccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buffer register as soon as the tpnccr0 register has been rewritten. consequently, the value t hat is compared with the 16-bit counter is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttpncc0 signal is generated. therefore, the inttpncc0 signal may not be generated at the valid edge count of "(d 1 + 1) times" or "(d 2 + 1) times" originally expected, but may be generated at the valid edge count of "(10000h + d 2 + 1) times".
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 257 (c) operation of tpnccr1 register figure 7-13. configuration of tpnccr1 register ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal inttpncc1 signal edge detector tipn0 pin remark n = 0 to 8 if the set value of the tpnccr1 register is smalle r than the set value of the tpnccr0 register, the inttpncc1 signal is generated once per cycle. figure 7-14. timing chart when d 01 d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal d 01 d 11 d 01 d 11 d 11 d 11 d 11 d 01 d 01 d 01 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 258 if the set value of the tpnccr1 register is greater than the set value of the tpnccr0 register, the inttpncc1 signal is not generated because the count va lue of the 16-bit counte r and the value of the tpnccr1 register do not match. figure 7-15. timing chart when d 01 < d 11 ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal d 01 d 11 d 01 d 01 d 01 d 01 l remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 259 7.5.3 external trigger pulse output m ode (tpnmd2 to tpnmd0 bits = 010) in the external trigger pulse output mode, 16-bit timer/event counter p waits for a trigger when the tpnctl0.tpnce bit is set to 1. when the valid edge of an ex ternal trigger input signal is detected, 16-bit timer/event counter p starts counting, and outputs a pwm waveform from the topn1 pin. pulses can also be output by generating a software trigger instead of using the external trigger. when using a software trigger, a square wave that has one cycle of the pwm waveform as half its cycle can also be output from the topn0 pin. figure 7-16. configuration in external trigger pulse output mode ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) output controller topn1 pin inttpncc1 signal topn0 pin count clock selection count start control edge detector software trigger generation tipn0 pin transfer transfer s r remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 260 figure 7-17. basic timing in exte rnal trigger pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 1 d 0 d 0 d 1 d 1 d 1 d 1 d 0 d 0 d 0 wait for trigger active level width (d 1 ) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) active level width (d 1 ) active level width (d 1 ) 16-bit timer/event counter p waits for a trigger when the tpnc e bit is set to 1. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts count ing at the same time, and out puts a pwm waveform from the topn1 pin. if the trigger is generated again while the counter is operating, the counter is cleared to 0000h and restarted. (the output of th e topn0 pin is inverted. the topn1 pin ou tputs a high-level regardless of the status (high/low) when a trigger occurs.) the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tpnccr1 register) count clock cycle cycle = (set value of tpnccr0 register + 1) count clock cycle duty factor = (set value of tpnccr1 regist er)/(set value of tpnccr0 register + 1) the compare match request signal inttpncc0 is generat ed when the 16-bit counter counts next time after its count value matches the value of the cc r0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttpncc1 is generated when t he count value of the 16-bit counter matches the value of the ccr1 buffer register. the value set to the tpnccrm register is transferred to the ccrm buffer register when the count value of the 16- bit counter matches the value of the ccrm buffer r egister and the 16-bit counter is cleared to 0000h. the valid edge of an external trigger input signal, or setti ng the software trigger (tpnctl1.tpnest bit) to 1 is used as the trigger. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 261 figure 7-18. setting of registers in exte rnal trigger pulse output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 1 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0/1 0/1 0 0 tpnctl1 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count with external event input signal generate software trigger when 1 is written 010 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 0, 1, 0: external trigger pulse output mode (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output settings of output level while operation of topn0 pin is disabled 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output specifies active level of topn1 pin output 0: active-high 1: active-low 0/1 0/1 0/1 note 2 tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 notes 1. the setting is invalid when the tpnctl1.tpneee bit = 1. 2. clear this bit to 0 when the topn0 pin is not used in the external trigger pulse output mode.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 262 figure 7-18. setting of registers in exte rnal trigger pulse output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external trigger input select valid edge of external event count input 0/1 0/1 0/1 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d 1 count clock cycle remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the external trigger pulse output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 263 (1) operation flow in extern al trigger pulse output mode figure 7-19. software processing flow in ex ternal trigger pulse output mode (1/2) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 10 d 00 d 00 d 01 d 00 d 00 d 10 d 10 d 11 d 10 d 10 d 10 d 11 d 10 d 01 d 00 d 10 d 10 d 00 d 10 d 00 d 11 d 11 d 01 d 01 d 01 <1> <2> <3> <4> <5> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 264 figure 7-19. software processing flow in ex ternal trigger pulse output mode (2/2) tpnce bit = 1 setting of tpnccr0 register register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting is enabled (tpnce bit = 1). trigger wait status tpnccr1 register write processing is necessary only when the set cycle is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. start setting of tpnccr1 register <1> count operation start flow <2> tpnccr0 and tpnccr1 register setting change flow setting of tpnccr0 register when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <4> tpnccr0, tpnccr1 register setting change flow only writing of the tpnccr1 register must be performed when the set duty factor is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <3> tpnccr0, tpnccr1 register setting change flow tpnce bit = 0 counting is stopped. stop <5> count operation stop flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 265 (2) external trigger pulse output mode operation timing (a) note on changing pulse width during operation to change the pwm waveform while the counter is operating, write the tpnccr1 register last. rewrite the tpnccrm register after writing the tpnccr 1 register after the inttpncc0 signal is detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 266 in order to transfer data from the tpnccrm register to the ccrm buffer register, the tpnccr1 register must be written. to change both the cycle and active level width of the pwm waveform at this time, first set the cycle to the tpnccr0 register and then set the active level width to the tpnccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tpnccr0 register, and then write the same value to the tpnccr1 register. to change only the active level width (duty factor) of the pwm waveform, only the tpnccr1 register has to be set. after data is written to the tpnccr1 register, the val ue written to the tpnccrm register is transferred to the ccrm buffer register in synchronization with clea ring of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tpnccr0 or tpnccr1 register again after writing the tpnccr1 register once, do so after the inttpncc0 signal is generated. otherwise, the value of the ccrm buffer register may become undefined because the timing of transferring data from the tpnc crm register to the ccrm buffer register conflicts with writing the tpnccrm register. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 267 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tpnccr1 register to 0000h. if the set value of the tpnccr0 register is ffffh, the inttpncc1 signal is generated periodically. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 0 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark n = 0 to 8 to output a 100% waveform, set a value of (set value of tpnccr0 register + 1) to the tpnccr1 register. if the set value of the tpnccr0 register is ffffh, 100% output cannot be produced. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 268 (c) conflict between trigger detecti on and match with tpnccr1 register if the trigger is detected immediately after the inttp ncc1 signal is generated, the 16-bit counter is immediately cleared to 0000h, the output signal of the topn1 pin is asserted, and the counter continues counting. consequently, the inactive peri od of the pwm waveform is shortened. 16-bit counter tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 1 d 1 ? 1 0000 ffff 0000 shortened remark n = 0 to 8 if the trigger is detected immediately before the inttp ncc1 signal is generated, the inttpncc1 signal is not generated, and the 16-bit counter is cleared to 0000h and continues counting. t he output signal of the topn1 pin remains active. consequently, the active period of the pwm waveform is extended. 16-bit counter tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) d 1 d 1 ? 2d 1 ? 1d 1 0000 ffff 0000 0001 extended remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 269 (d) conflict between trigger detecti on and match with tpnccr0 register if the trigger is detected immediately after the inttp ncc0 signal is generated, the 16-bit counter is cleared to 0000h and continues counting up. therefore, the active period of the topn1 pin is extended by time from generation of the inttpncc0 signal to trigger detection. 16-bit counter tpnccr0 register inttpncc0 signal topn1 pin output external trigger input (tipn0 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0000 extended remark n = 0 to 8 if the trigger is detected immediately before the inttp ncc0 signal is generated, the inttpncc0 signal is not generated. the 16-bit counter is cleared to 0000h, the topn1 pin is asserted, and the counter continues counting. consequently, the inactive period of the pwm waveform is shortened. 16-bit counter tpnccr0 register inttpncc0 signal topn1 pin output external trigger input (tipn0 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0001 shortened remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 270 (e) generation timing of compare match interrupt request signal (inttpncc1) the timing of generation of the inttpncc1 signal in the external trigger pulse output mode differs from the timing of other inttpncc1 signals; the inttpncc1 signal is generated when the count value of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 2d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated in synch ronization with the next count up, after the count value of the 16-bit counter matches the value of the tpnccr1 register. in the external trigger pulse output mode, however, it is generated one clock earlier. this is because the timing is changed to match the timing of cha nging the output signal of the topn1 pin.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 271 7.5.4 one-shot pulse output mode (tpnmd2 to tpnmd0 bits = 011) in the one-shot pulse output mode, 16-bit timer/event coun ter p waits for a trigger when the tpnctl0.tpnce bit is set to 1. when the valid edge of an external trigger input is detected, 16-bit timer/event co unter p starts counting, and outputs a one-shot pulse from the topn1 pin. instead of the external trigger, a software trigger can also be generated to output the pulse. when the software trigger is used, the topn0 pin outputs the active level while the 16-bit counter is counting, and the inactive level when the counter is stopped (waiting for a trigger). figure 7-20. configuration in one-shot pulse output mode ccr0 buffer register tpnce bit tpnccr0 register tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) topn1 pin inttpncc1 signal topn0 pin count clock selection count start control edge detector software trigger generation tipn0 pin transfer transfer s r output controller (rs-ff) s r 16-bit counter remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 272 figure 7-21. basic timing in one-shot pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 1 d 0 d 0 d 1 d 1 d 1 d 0 d 0 delay (d 1 ) delay (d 1 ) delay (d 1 ) active level width (d 0 ? d 1 + 1) active level width (d 0 ? d 1 + 1) active level width (d 0 ? d 1 + 1) when the tpnce bit is set to 1, 16-bit timer/event counter p waits for a trigger. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts counti ng, and outputs a one-shot pul se from the topn1 pin. after the one-shot pulse is output, the 16-bit counter is set to ffffh, stops counting, and waits for a trigger. if a trigger is generated again while the one-s hot pulse is being output, it is ignored. the output delay period and active level width of the one-shot pulse can be calculated as follows. output delay period = (set value of tpnccr1 register) count clock cycle active level width = (set value of tpnccr0 register ? set value of tpnccr1 register + 1) count clock cycle the compare match interrupt request signal inttpncc0 is generated when the 16-bit counter counts after its count value matches the value of the ccr0 buffer regist er. the compare match interrupt request signal inttpncc1 is generated when the count value of the 16-bit counter matches the va lue of the ccr1 buffer register. the valid edge of an external trigger input or setting the so ftware trigger (tpnctl1.tpnest bit) to 1 is used as the trigger. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 273 figure 7-22. setting of registers in one-shot pulse output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 1 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0/1 0/1 0 0 tpnctl1 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count external event input signal generate software trigger when 1 is written 011 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 0, 1, 1: one-shot pulse output mode (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of output level while operation of topn0 pin is disabled 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output specifies active level of topn1 pin output 0: active-high 1: active-low 0/1 0/1 note 2 0/1 note 2 tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 notes 1. the setting is invalid when the tpnctl1.tpneee bit = 1. 2. clear this bit to 0 when the topn0 pin is not used in the one-shot pulse output mode.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 274 figure 7-22. setting of registers in one-shot pulse output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external trigger input select valid edge of external event count input 0/1 0/1 0/1 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the active level width and output delay period of the one-shot pulse are as follows. active level width = (d 1 ? d 0 + 1) count clock cycle output delay period = (d 1 ) count clock cycle remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the one-shot pulse output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 275 (1) operation flow in one-shot pulse output mode figure 7-23. software processing flow in one-shot pulse output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) <1> <3> tpnce bit = 1 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). trigger wait status start <1> count operation start flow tpnce bit = 0 count operation is stopped stop <3> count operation stop flow d 10 d 00 d 11 d 01 d 00 d 10 d 11 <2> d 01 setting of tpnccr0, tpnccr1 registers as rewriting the tpnccrm register immediately forwards to the ccrm buffer register, rewriting immediately after the generation of the inttpnccr0 signal is recommended. <2> tpnccr0, tpnccr1 register setting change flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 276 (2) operation timing in one-shot pulse output mode (a) note on rewriti ng tpnccrm register to change the set value of the tpnccrm register to a smaller value, stop counting once, and then change the set value. if the value of the tpnccrm register is rewritten to a smaller value during counting, the 16-bit counter may overflow. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal tpnccr1 register inttpncc1 signal topn1 pin output external trigger input (tipn0 pin input) topn0 pin output (only when software trigger is used) d 10 d 11 d 00 d 01 d 00 d 10 d 10 d 10 d 01 d 11 d 00 d 00 delay (d 10 ) delay (d 10 ) active level width (d 00 ? d 10 + 1) active level width (d 00 ? d 10 + 1) delay (10000h + d 11 ) active level width (d 01 ? d 11 + 1) when the tpnccr0 register is rewritten from d 00 to d 01 and the tpnccr1 register from d 10 to d 11 where d 00 > d 01 and d 10 > d 11 , if the tpnccr1 register is rewritten when the count value of the 16-bit counter is greater than d 11 and less than d 10 and if the tpnccr0 register is rewritten when the count value is greater than d 01 and less than d 00 , each set value is reflected as soon as the register has been rewritten and compared with the count value. the counter count s up to ffffh and then counts up again from 0000h. when the count value matches d 11 , the counter generates the inttpncc1 signal and asserts the topn1 pin. when the count value matches d 01 , the counter generates the in ttpncc0 signal, deasserts the topn1 pin, and stops counting. therefore, the counter may output a pulse with a delay period or ac tive period different from that of the one-shot pulse that is originally expected. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 277 (b) generation timing of compare match interrupt request signal (inttpncc1) the generation timing of the inttpncc1 signal in the on e-shot pulse output mode is different from other inttpncc1 signals; the inttpncc1 signal is genera ted when the count value of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 2d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated when the 16- bit counter counts up next time after its count value matches the value of the tpnccr1 register. in the one-shot pulse output mode, howe ver, it is generated one clock earlier. this is because the timing is changed to match the change timing of the topn1 pin. remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 278 7.5.5 pwm output mode (tpnmd 2 to tpnmd0 bits = 100) in the pwm output mode, a pwm waveform is output from the topn1 pin when the tpnctl0.tpnce bit is set to 1. in addition, a pulse with one cycle of the pwm waveform as half its cycle is output from the topn0 pin. figure 7-24. configuration in pwm output mode ccr0 buffer register tpnce bit tpnccr0 register 16-bit counter tpnccr1 register ccr1 buffer register clear match signal match signal inttpncc0 signal output controller (rs-ff) output controller topn1 pin inttpncc1 signal topn0 pin count clock selection count start control transfer transfer s r remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 279 figure 7-25. basic timing in pwm output mode ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal topn0 pin output tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01 active period (d 10 ) cycle (d 00 + 1) inactive period (d 00 ? d 10 + 1) when the tpnce bit is set to 1, the 16-bit counter is cleared from ffffh to 0000h, starts count ing, and outputs a pwm waveform from the topn1 pin. the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tpnccr1 register ) count clock cycle cycle = (set value of tpnccr0 register + 1) count clock cycle duty factor = (set value of tpnccr1 regist er)/(set value of tpnccr0 register + 1) the pwm waveform can be changed by rewriting the tpnccrm register while the counter is operating. the newly written value is reflected when the count value of the 16-bit counter matches the value of the ccr0 buffer register and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttpncc0 is generated when the 16-bit counter counts next time after its count value matches the value of the ccr0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttpncc1 is gener ated when the count value of the 16-bit counter matches the value of the ccr1 buffer register. the value set to the tpnccrm register is transferred to the ccrm buffer register when the count value of the 16- bit counter matches the value of the ccrm buffer r egister and the 16-bit counter is cleared to 0000h. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 280 figure 7-26. setting of registers in pwm output mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 1 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce (b) tmpn control register 1 (tpnctl1) 0 0 0/1 0 0 tpnctl1 100 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 0, 0: pwm output mode 0: operate on count clock selected by tpncks0 to tpncks2 bits 1: count external event input signal (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of output level while operation of topn0 pin is disabled 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output specifies active level of topn1 pin output 0: active-high 1: active-low 0/1 0/1 0/1 note 2 tpnoe1 tpnol0 tpnoe0 tpnol1 topn1 pin output 16-bit counter ? when tpnol1 bit = 0 topn1 pin output 16-bit counter ? when tpnol1 bit = 1 notes 1. the setting is invalid when the tpnctl1.tpneee bit = 1. 2. clear this bit to 0 when the topn0 pin is not used in the pwm output mode.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 281 figure 7-26. register setting in pwm output mode (2/2) (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input. 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1 (e) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (f) tmpn capture/compare register s 0 and 1 (tpnccr0 and tpnccr1) if d 0 is set to the tpnccr0 register and d 1 to the tpnccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d 1 count clock cycle remarks 1. tmpn i/o control register 1 (tpnioc1) and tmpn option register 0 (tpnopt0) are not used in the pwm output mode. 2. n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 282 (1) operation flow in pwm output mode figure 7-27. software processing flow in pwm output mode (1/2) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register inttpncc0 signal topn0 pin output tpnccr1 register ccr1 buffer register inttpncc1 signal topn1 pin output d 10 d 00 d 00 d 01 d 00 d 00 d 10 d 10 d 11 d 10 d 10 d 10 d 11 d 10 d 01 d 00 d 10 d 10 d 00 d 10 d 00 d 11 d 11 d 01 d 01 d 01 <2> <3> <4> <5> <1> remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 283 figure 7-27. software processing flow in pwm output mode (2/2) tpnce bit = 1 setting of tpnccr0 register register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting is enabled (tpnce bit = 1). tpnccr1 write processing is necessary only when the set cycle is changed. when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. start setting of tpnccr1 register <1> count operation start flow <2> tpnccr0, tpnccr1 register setting change flow setting of tpnccr0 register when the counter is cleared after setting, the value of the tpnccrm register is transferred to the ccrm buffer register. setting of tpnccr1 register <4> tpnccr0, tpnccr1 register setting change flow only writing of the tpnccr1 register must be performed when the set duty factor is changed. when the counter is cleared after setting, the value of compare register m is transferred to the ccrm buffer register. setting of tpnccr1 register <3> tpnccr0, tpnccr1 register setting change flow tpnce bit = 0 counting is stopped. stop <5> count operation stop flow remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 284 (2) pwm output mode operation timing (a) changing pulse width during operation to change the pwm waveform while the counter is operating, write the tpnccr1 register last. rewrite the tpnccrm register after writing the tpnccr 1 register after the inttpncc1 signal is detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register ccr0 buffer register tpnccr1 register ccr1 buffer register topn1 pin output inttpncc0 signal d 10 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 11 d 01 d 10 d 10 d 00 d 00 d 11 d 11 d 01 d 01 to transfer data from the tpnccrm register to the ccrm buffer register, the tpnccr1 register must be written. to change both the cycle and active level of the pwm waveform at this time, first set the cycle to the tpnccr0 register and then set the active level to the tpnccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tpnccr0 register, and then write the same value to the tpnccr1 register. to change only the active level width (duty factor) of the pwm waveform, only the tpnccr1 register has to be set. after data is written to the tpnccr1 register, the val ue written to the tpnccrm register is transferred to the ccrm buffer register in synchronization with clea ring of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tpnccr0 or tpnccr1 register again after writing the tpnccr1 register once, do so after the inttpncc0 signal is generated. otherwise, the value of the ccrm buffer register may become undefined because the timing of transferring data from the tpnc crm register to the ccrm buffer register conflicts with writing the tpnccrm register. remark n = 0 to 8, m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 285 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tpnccr1 register to 0000h. if the set value of the tpnccr0 register is ffffh, the inttpncc1 signal is generated periodically. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 00 0000h d 00 0000h d 00 0000h d 00 ? 1d 00 0000 ffff 0000 d 00 ? 1d 00 0000 0001 remark n = 0 to 8 to output a 100% waveform, set a value of (set value of tpnccr0 register + 1) to the tpnccr1 register. if the set value of the tpnccr0 register is ffffh, 100% output cannot be produced. count clock 16-bit counter tpnce bit tpnccr0 register tpnccr1 register inttpncc0 signal inttpncc1 signal topn1 pin output d 00 d 00 + 1 d 00 d 00 + 1 d 00 d 00 + 1 d 00 ? 1d 00 0000 ffff 0000 d 00 ? 1d 00 0000 0001 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 286 (c) generation timing of compare match interrupt request signal (inttpncc1) the timing of generation of the inttpncc1 signal in the pwm output mode differs from the timing of other inttpncc1 signals; the inttpncc1 signal is genera ted when the count value of the 16-bit counter matches the value of the tpnccr1 register. count clock 16-bit counter tpnccr1 register topn1 pin output inttpncc1 signal d 1 d 1 ? 2d 1 ? 1d 1 d 1 + 1 d 1 + 2 remark n = 0 to 8 usually, the inttpncc1 signal is generated in synch ronization with the next counting up after the count value of the 16-bit counter matches the value of the tpnccr1 register. in the pwm output mode, however, it is generated one clock earlier. this is because the timing is changed to match the change timing of the output signal of the topn1 pin.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 287 7.5.6 free-running timer mode (t pnmd2 to tpnmd0 bits = 101) in the free-running timer mode, 16-bit timer/event counter p starts counting when the tp nctl0.tpnce bit is set to 1. at this time, the tpnccrm register can be used as a compare register or a capt ure register, depending on the setting of the tpnopt0.tpnccs 0 and tpnopt0.tpnccs1 bits. figure 7-28. configuration in free-running timer mode tpnccr0 register (capture) tpnce bit tpnccr1 register (compare) 16-bit counter tpnccr1 register (compare) tpnccr0 register (capture) output controller tpnccs0, tpnccs1 bits (capture/compare selection) topn0 pin output output controller topn1 pin output edge detector count clock selection edge detector edge detector tipn0 pin (external event count input/ capture trigger input) tipn1 pin (capture trigger input) internal count clock 0 1 0 1 inttpnov signal inttpncc1 signal inttpncc0 signal remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 288 when the tpnce bit is set to 1, 16-bit timer/event counter p starts counting, and the ou tput signals of the topn0 and topn1 pins are inverted. when the count value of the 16-bit counter later matches the set value of the tpnccrm register, a compare match interrupt request sign al (inttpnccm) is generated, and the output signal of the topnm pin is inverted. the 16-bit counter continues counting in synchronization with t he count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttpnov) at the next clock, is cl eared to 0000h, and continues counting. at this time, the overflow flag (tpnopt0.tpnovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction by software. the tpnccrm register can be rewritten while the counter is oper ating. if it is rewritten, the new value is reflected at that time, and compared with the count value. figure 7-29. basic timing in free-r unning timer mode (compare function) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn0 pin output tpnccr1 register inttpncc1 signal topn1 pin output inttpnov signal tpnovf bit d 00 d 01 d 10 d 11 d 00 d 10 d 10 d 11 d 11 d 11 d 00 d 01 d 01 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 289 when the tpnce bit is set to 1, the 16- bit counter starts counting. when the valid edge input to the tipnm pin is detected, the count val ue of the 16-bit counter is stored in the tpn ccrm register, and a capture interrupt request signal (inttpnccm) is generated. the 16-bit counter continues counting in synchronization with t he count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttpnov) at the next clock, is cl eared to 0000h, and continues counting. at this time, the overflow flag (tpnopt0.tpnovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction by software. figure 7-30. basic timing in free-r unning timer mode (capture function) ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit d 00 d 01 d 02 d 03 d 10 d 00 d 01 d 02 d 03 d 11 d 12 d 13 d 10 d 11 d 12 d 13 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 290 figure 7-31. register setting in free-running timer mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce note the setting is invalid when the tpnctl1.tpneee bit = 1 (b) tmpn control register 1 (tpnctl1) 0 0 0/1 0 0 tpnctl1 101 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 0, 1: free-running mode 0: operate with count clock selected by tpncks0 to tpncks2 bits 1: count on external event count input signal (c) tmpn i/o control register 0 (tpnioc0) 0 0 0 0 0/1 tpnioc0 0: disable topn0 pin output 1: enable topn0 pin output setting of output level with operation of topn0 pin disabled 0: low level 1: high level 0: disable topn1 pin output 1: enable topn1 pin output setting of output level with operation of topn1 pin disabled 0: low level 1: high level 0/1 0/1 0/1 tpnoe1 tpnol0 tpnoe0 tpnol1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 291 figure 7-31. register setting in free-running timer mode (2/2) (d) tmpn i/o control register 1 (tpnioc1) 0 0 0 0 0/1 tpnioc1 select valid edge of tipn0 pin input select valid edge of tipn1 pin input 0/1 0/1 0/1 tpnis2 tpnis1 tpnis0 tpnis3 (e) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1 (f) tmpn option register 0 (tpnopt0) 0 0 0/1 0/1 0 tpnopt0 overflow flag specifies if tpnccr0 register functions as capture or compare register specifies if tpnccr1 register functions as capture or compare register 0 0 0/1 tpnccs0 tpnovf tpnccs1 (g) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (h) tmpn capture/compare regist ers 0 and 1 (tpnccr0 and tpnccr1) these registers function as captur e registers or compare registers depending on the setting of the tpnopt0.tpnccsm bit. when the registers function as captur e registers, they store the count value of the 16-bit counter when the valid edge input to the tipnm pin is detected. when the registers function as compare registers and when d m is set to the tpnccrm register, the inttpnccm signal is generated when the counter reaches (d m + 1), and the output signal of the topnm pin is inverted. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 292 (1) operation flow in free-running timer mode (a) when using capture/compare register as compare register figure 7-32. software processing flow in fr ee-running timer mode (c ompare function) (1/2) ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn0 pin output tpnccr1 register inttpncc1 signal topn1 pin output inttpnov signal tpnovf bit d 00 d 01 d 10 d 11 d 00 d 10 d 10 d 11 d 11 d 11 d 00 d 01 d 01 cleared to 0 by clr instruction set value changed cleared to 0 by clr instruction cleared to 0 by clr instruction <1> <2> <2> <2> <3> set value changed remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 293 figure 7-32. software processing flow in fr ee-running timer mode (c ompare function) (2/2) tpnce bit = 1 read tpnopt0 register (check overflow flag). register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc0 register, tpnioc2 register, tpnopt0 register, tpnccr0 register, tpnccr1 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). start execute instruction to clear tpnovf bit (clr tpnovf). <1> count operation start flow <2> overflow flag clear flow tpnce bit = 0 counter is initialized and counting is stopped by clearing tpnce bit to 0. stop <3> count operation stop flow tpnovf bit = 1 no yes remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 294 (b) when using capture/compare register as capture register figure 7-33. software processing flow in fr ee-running timer mode (c apture function) (1/2) ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit d 00 0000 0000 d 01 d 02 d 03 d 10 d 00 d 01 d 02 d 03 d 11 d 12 d 10 0000 d 11 d 12 0000 cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 295 figure 7-33. software processing flow in fr ee-running timer mode (c apture function) (2/2) tpnce bit = 1 read tpnopt0 register (check overflow flag). register initial setting tpnctl0 register (tpncks0 to tpncks2 bits) tpnctl1 register, tpnioc1 register, tpnopt0 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). start execute instruction to clear tpnovf bit (clr tpnovf). <1> count operation start flow <2> overflow flag clear flow tpnce bit = 0 counter is initialized and counting is stopped by clearing tpnce bit to 0. stop <3> count operation stop flow tpnovf bit = 1 no yes remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 296 (2) operation timing in free-running timer mode (a) interval operation with compare register when 16-bit timer/event counter p is used as an inte rval timer with the tpnccrm register used as a compare register, software processing is necessary for setting a comparison value to generate the next interrupt request signal each time the inttpnccm signal has been detected. ffffh 16-bit counter 0000h tpnce bit tpnccr0 register inttpncc0 signal topn pin output tpnccr1 register inttpncc1 signal topn1 pin output d 00 d 01 d 02 d 03 d 04 d 05 d 10 d 00 d 11 d 01 d 12 d 04 d 13 d 02 d 03 d 11 d 10 d 12 d 13 d 14 interval period (d 10 + 1) interval period (10000h + d 11 ? d 10 ) interval period (10000h + d 12 ? d 11 ) interval period (10000h + d 13 ? d 12 ) interval period (d 00 + 1) interval period (10000h + d 01 ? d 00 ) interval period (d 02 ? d 01 ) interval period (10000h + d 03 ? d 02 ) interval period (10000h + d 04 ? d 03 ) when performing an interval operation in the free-running timer mode, two intervals can be set with one channel. to perform the interval operation, the value of the corresponding tpnccr m register must be re-set in the interrupt servicing that is executed when the inttpnccm signal is detected. the set value for re-setting the tpnccrm register c an be calculated by the following expression, where "d m " is the interval period. compare register default value: d m ? 1 value set to compare register second and subsequent time: previous set value + d m (if the calculation result is greate r than ffffh, subtract 10000h from the result and set this value to the register.) remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 297 (b) pulse width measurement with capture register when pulse width measurement is performed with the tpnccrm register used as a capture register, software processing is necessary for reading the capt ure register each time the inttpnccm signal has been detected and for calculating an interval. ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal tipn1 pin input tpnccr1 register inttpncc1 signal inttpnov signal tpnovf bit 0000h d 00 d 01 d 02 d 03 d 04 d 10 d 00 d 11 d 01 d 12 d 04 d 13 d 02 d 03 d 10 0000h d 11 d 12 d 13 pulse interval (d 00 ) pulse interval (10000h + d 01 ? d 00 ) pulse interval (d 02 ? d 01 ) pulse interval (10000h + d 03 ? d 02 ) pulse interval (10000h + d 04 ? d 03 ) pulse interval (d 10 ) pulse interval (10000h + d 11 ? d 10 ) pulse interval (10000h + d 12 ? d 11 ) pulse interval (10000h + d 13 ? d 12 ) cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction when executing pulse width measurement in the fr ee-running timer mode, two pulse widths can be measured with one channel. to measure a pulse width, the pu lse width can be calculated by reading the value of the tpnccrm register in synchronization with the inttpnccm si gnal, and calculating the difference between the read value and the previously read value. remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 298 (c) processing of overflow when two capture registers are used care must be exercised in processing the overflow flag when two capture registers are used. first, an example of incorrect processing is shown below. example of incorrect processing when two capture regi sters are used ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register tipn1 pin input tpnccr1 register inttpnov signal tpnovf bit d 00 d 01 d 10 d 11 d 10 <1> <2> <3> <4> d 00 d 11 d 01 the following problem may occur when two pulse widt hs are measured in the free-running timer mode. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> read the tpnccr0 register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <4> read the tpnccr1 register. read the overflow flag. because the flag is cleared in <3>, 0 is read. because the overflow flag is 0, the pulse width can be calculated by (d 11 ? d 10 ) (incorrect). when two capture registers are used, and if the overflow flag is cleared to 0 by one capture register, the other capture register may not obtain the correct pulse width. use software when using two capture registers. an example of how to use software is shown below.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 299 (1/2) example when two capture registers are used (usi ng overflow interrupt) ffffh 16-bit counter 0000h tpnce bit inttpnov signal tpnovf bit tpnovf0 flag note tipn0 pin input tpnccr0 register tpnovf1 flag note tipn1 pin input tpnccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tpnovf0 and tpnovf1 flags are set on the internal ram by software. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> an overflow occurs. set the tpnovf0 and tpnovf 1 flags to 1 in the overflow interrupt servicing, and clear the overflow flag to 0. <4> read the tpnccr0 register. read the tpnovf0 flag. if the tpnovf0 flag is 1, clear it to 0. because the tpnovf0 flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tpnccr1 register. read the tpnovf1 flag. if the tpnovf1 flag is 1, clear it to 0 (the tpnovf0 flag is cleared in <4>, and the tpnovf1 flag remains 1). because the tpnovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 300 (2/2) example when two capture re gisters are used (without using overflow interrupt) ffffh 16-bit counter 0000h tpnce bit inttpnov signal tpnovf bit tpnovf0 flag note tipn0 pin input tpnccr0 register tpnovf1 flag note tipn1 pin input tpnccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tpnovf0 and tpnovf1 flags are set on the internal ram by software. <1> read the tpnccr0 register (setting of t he default value of the tipn0 pin input). <2> read the tpnccr1 register (setting of t he default value of the tipn1 pin input). <3> an overflow occurs. nothing is done by software. <4> read the tpnccr0 register. read the overflow flag. if the overflow flag is 1, set only the tpnovf1 flag to 1, and clear the overflow flag to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tpnccr1 register. read the overflow flag. because the overflow flag is cleared in <4>, 0 is read. read the tpnovf1 flag. if the tpnovf1 flag is 1, clear it to 0. because the tpnovf1 flag is 1, the pul se width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 301 (d) processing of overflow if capture trigger interval is long if the pulse width is greater than one cycle of the 16- bit counter, care must be exercised because an overflow may occur more than once from the first captur e trigger to the next. first, an example of incorrect processing is shown below. example of incorrect processing when capture trigger interval is long ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnov signal tpnovf bit d m0 d m1 d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width the following problem may occur when long pulse width is measured in the free-running timer mode. <1> read the tpnccrm register (setting of t he default value of the tipnm pin input). <2> an overflow occurs. nothing is done by software. <3> an overflow occurs a second time. nothing is done by software. <4> read the tpnccrm register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pul se width can be calculated by (10000h + d m1 ? d m0 ) (incorrect). actually, the pulse width must be (20000h + d m1 ? d m0 ) because an overflow occurs twice. if an overflow occurs twice or more when the capture tr igger interval is long, the correct pulse width may not be obtained. if the capture trigger interval is long, slow the count clock to lengthen one cycle of the 16-bit counter, or use software. an example of how to use software is shown next.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 302 example when capture trigger interval is long ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnov signal tpnovf bit overflow counter note d m0 d m1 1h 0h 2h 0h d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width note the overflow counter is set arbitrarily by software on the internal ram. <1> read the tpnccrm register (setting of t he default value of the tipnm pin input). <2> an overflow occurs. increment the overflow count er and clear the overflow flag to 0 in the overflow interrupt servicing. <3> an overflow occurs a second time. increment (+1) the overflow counter and clear the overflow flag to 0 in the overflow interrupt servicing. <4> read the tpnccrm register. read the overflow counter. when the overflow counter is "n", t he pulse width can be calculated by (n 10000h + d m1 ? d m0 ). in this example, the pulse width is (20000h + d m1 ? d m0 ) because an overflow occurs twice. clear the overflow counter (0h).
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 303 (e) clearing overflow flag the overflow flag can be cleared to 0 by clearing th e tpnovf bit to 0 with the clr instruction and by writing 8-bit data (bit 0 is 0) to the tpnopt0 regist er. to accurately detect an overflow, read the tpnovf bit when it is 1, and then clear the overflow flag by using a bit manipulation instruction. (i) operation to write 0 (without conflict with setting) (iii) operation to clear to 0 (without conflict with setting) (ii) operation to write 0 (conflict with setting) (iv) operation to clear to 0 (conflict with setting) 0 write signal overflow set signal register access signal overflow flag (tpnovf bit) read write 0 write signal overflow set signal register access signal overflow flag (tpnovf bit) read write 0 write signal overflow set signal 0 write signal overflow set signal overflow flag (tpnovf bit) overflow flag (tpnovf bit) l h l remark n = 0 to 8 to clear the overflow flag to 0, read the overflow flag to check if it is set to 1, and clear it with the clr instruction. if 0 is written to the overflow flag wit hout checking if the flag is 1, the set information of overflow may be erased by writing 0 ((ii) in the above chart). therefore, software may judge that no overflow has occurred even when an overflow actually has occurred. if execution of the clr instruction conflicts with occurrence of an over flow when the overflow flag is cleared to 0 with the clr instruction, the overflow flag remains set even after execution of the clear instruction.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 304 7.5.7 pulse width measurement mode (tpnmd2 to tpnmd0 bits = 110) in the pulse width measurement mode, 16-bit timer/event counter p starts counting when the tpnctl0.tpnce bit is set to 1. each time the valid edge input to the tipnm pin has been detected, the count value of the 16-bit counter is stored in the tpnccrm register, and the 16-bit counter is cleared to 0000h. the interval of the valid edge can be measured by reading the tpnccrm register after a capture interrupt request signal (inttpnccm) occurs. select either the tipn0 or tipn1 pin as the capture trigger input pin. s pecify "no edge detected" by using the tpnioc1 register for the unused pins. when an external clock is used as the count clock, measur e the pulse width of the tipn1 pin because the external clock is fixed to the tipn0 pin. at this time, clear the tpnioc1.tpnis1 and tpnioc1.tpnis0 bits to 00 (capture trigger input (tipn0 pin): no edge detected). figure 7-34. configuration in pulse width measurement mode tpnccr0 register (capture) tpnce bit tpnccr1 register (capture) edge detector count clock selection edge detector edge detector tipn0 pin (external event count input/capture trigger input) tipn1 pin (capture trigger input) internal count clock clear inttpnov signal inttpncc0 signal inttpncc1 signal 16-bit counter remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 305 figure 7-35. basic timing in pulse width measurement mode ffffh 16-bit counter 0000h tpnce bit tipnm pin input tpnccrm register inttpnccm signal inttpnov signal tpnovf bit d 0 0000h d 1 d 2 d 3 cleared to 0 by clr instruction remark n = 0 to 8 m = 0, 1 when the tpnce bit is set to 1, the 16- bit counter starts counting. when the valid edge input to the tipnm pin is later detected, the count value of the 16-bit counter is stored in the tpnccrm register, the 16-bit counter is cleared to 0000h, and a capture interrupt request signal (inttpnccm) is generated. the pulse width is calculated as follows. pulse width = captured value count clock cycle if the valid edge is not input to the tipnm pin even wh en the 16-bit counter counted up to ffffh, an overflow interrupt request signal (inttpnov) is generated at the next count clock, and the counter is cleared to 0000h and continues counting. at this time, the overflow flag (tpnopt0.t pnovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction via software. if the overflow flag is set to 1, the pu lse width can be calculated as follows. pulse width = (10000h tpnovf bit set (1) count + captured value) count clock cycle remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 306 figure 7-36. register setting in pu lse width measurement mode (1/2) (a) tmpn control register 0 (tpnctl0) 0/1 0 0 0 0 tpnctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tpncks2 tpncks1 tpncks0 tpnce note setting is invalid when the tpneee bit = 1. (b) tmpn control register 1 (tpnctl1) 0 0 0/1 0 0 tpnctl1 110 tpnmd2 tpnmd1 tpnmd0 tpneee tpnest 1, 1, 0: pulse width measurement mode 0: operate with count clock selected by tpncks0 to tpncks2 bits 1: count external event count input signal (c) tmpn i/o control register 1 (tpnioc1) 0 0 0 0 0/1 tpnioc1 select valid edge of tipn0 pin input select valid edge of tipn1 pin input 0/1 0/1 0/1 tpnis2 tpnis1 tpnis0 tpnis3 (d) tmpn i/o control register 2 (tpnioc2) 0 0 0 0 0/1 tpnioc2 select valid edge of external event count input 0/1 0 0 tpnees0 tpnets1 tpnets0 tpnees1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 307 figure 7-36. register setting in pu lse width measurement mode (2/2) (e) tmpn option register 0 (tpnopt0) 00000 tpnopt0 overflow flag 0 0 0/1 tpnccs0 tpnovf tpnccs1 (f) tmpn counter read bu ffer register (tpncnt) the value of the 16-bit counter can be read by reading the tpncnt register. (g) tmpn capture/compare regist ers 0 and 1 (tpnccr0 and tpnccr1) these registers store the count va lue of the 16-bit counter when the valid edge input to the tipnm pin is detected. remarks 1. tmpn i/o control register 0 (tpnioc0) is not used in the pulse wid th measurement mode. 2. n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 308 (1) operation flow in pul se width measurement mode figure 7-37. software processing flow in pulse width measurement mode <1> <2> set tpnctl0 register (tpnce bit = 1) tpnce bit = 0 register initial setting tpnctl0 register (tpncks0 to tpncks2 bits), tpnctl1 register, tpnioc1 register, tpnioc2 register, tpnopt0 register initial setting of these registers is performed before setting the tpnce bit to 1. the tpncks0 to tpncks2 bits can be set at the same time when counting has been started (tpnce bit = 1). the counter is initialized and counting is stopped by clearing the tpnce bit to 0. start stop <1> count operation start flow <2> count operation stop flow ffffh 16-bit counter 0000h tpnce bit tipn0 pin input tpnccr0 register inttpncc0 signal d 0 0000h 0000h d 1 d 2 remark n = 0 to 8
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 309 (2) operation timing in pul se width measurement mode (a) clearing overflow flag the overflow flag can be cleared to 0 by clearing th e tpnovf bit to 0 with the clr instruction and by writing 8-bit data (bit 0 is 0) to the tpnopt0 regist er. to accurately detect an overflow, read the tpnovf bit when it is 1, and then clear the overflow flag by using a bit manipulation instruction. (i) operation to write 0 (without conflict with setting) (iii) operation to clear to 0 (without conflict with setting) (ii) operation to write 0 (conflict with setting) (iv) operation to clear to 0 (conflict with setting) 0 write signal overflow set signal register access signal overflow flag (tpnovf bit) read write 0 write signal overflow set signal register access signal overflow flag (tpnovf bit) read write 0 write signal overflow set signal 0 write signal overflow set signal overflow flag (tpnovf bit) overflow flag (tpnovf bit) l h l remark n = 0 to 8 to clear the overflow flag to 0, read the overflow flag to check if it is set to 1, and clear it with the clr instruction. if 0 is written to the overflow flag wit hout checking if the flag is 1, the set information of overflow may be erased by writing 0 ((ii) in the above chart). therefore, software may judge that no overflow has occurred even when an overflow actually has occurred. if execution of the clr instruction conflicts with occurrence of an over flow when the overflow flag is cleared to 0 with the clr instruction, the overflow flag remains set even after execution of the clear instruction.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 310 7.5.8 timer output operations the following table shows the operations and out put levels of the topn0 and topn1 pins. table 7-4. timer output control in each mode operation mode topn1 pin topn0 pin interval timer mode square wave output external event count mode square wave output ? external trigger pulse output mode external trigger pulse output one-shot pulse output mode one-shot pulse output pwm output mode pwm output square wave output free-running timer mode square wave output (only when compare function is used) pulse width measurement mode ? remark n = 0 to 8 table 7-5. truth table of topn0 and topn1 pins under control of timer output control bits tpnioc0.tpnolm bit tpnioc0.tpnoem bit tpnctl0.tpnce bit level of topnm pin 0 low-level output 0 low-level output 0 1 1 low level immediately before counting, high level after counting is started 0 high-level output 0 high-level output 1 1 1 high level immediately before counting, low level after counting is started remark n = 0 to 8 m = 0, 1
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 311 7.6 selector function in the v850es/jj2, the capture trigger input for tmp1/t mp3 can be selected from the input signal via the port/timer alternate-function pin (tip10/ti p11/tip31) and the peripheral i/o (t mp/uarta) input signal via the uarta reception alternate-function pin (rxda0/rxda1/rxda3). this function makes the following possible. ? the tip10 and tip11 input signals for tmp1 can be selected from the signal s via the port/timer alternate-function pins (tip10 and tip11) and the signals via the uarta re ception alternate-function pins (rxda0 and rxda1). similarly, the tip31 input signal fo r tmp3 can be selected from the signal via the port/timer alternate-function pin (tip31) and the signal via the uarta reception alternate-function pin (rxda3). when the rxda0, rxda1, or rxda3 signal for uarta0, for uarta1, or uarta3 is selected, the baud rate error of the uarta lin reception transfer rate can be calculated. cautions 1. when using the selector function, be sure to set the port/timer al ternate function pins for tmp to be connected to the capture tripper input. 2. disable the peripheral i/os to be connect ed (tmp/uarta) before setting the selector function. the capture trigger input can be sele cted using the following register.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 312 (1) selector operation control register 0 (selcnt0) the selcnt0 register is an 8-bit register that selects the capture trigger for tmp1 and tmp3. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tip31 pin input rxda3 pin input isel6 0 1 selection of tip31 input signal (tmp3) selcnt0 isel6 0 isel4 isel3 0 0 0 tip11 pin input rxda1 pin input isel4 0 1 selection of tip11 input signal (tmp1) tip10 pin input rxda0 pin input isel3 0 1 selection of tip10 input signal (tmp1) after reset: 00h r/w address: fffff308h < > < > < > cautions 1. when setting the isel3, isel4, or isel6 bit to 1, be sure to set the corresponding alternate-function pin to the capture trigger input. 2. be sure to clear bits 7, 5, 2, 1, and 0 to ?0?.
chapter 7 16-bit timer/event counter p (tmp) preliminary user's manual u17714ej1v0ud 313 7.7 cautions (1) capture operation when the capture operation is used and a slow clock is selected as the count clock, ffffh, not 0000h, may be captured in the tpnccr0 and tpnccr1 registers if the capture trigger is input immediately after the tpnce bit is set to 1. (a) free-running timer mode count clock 0000h ffffh tpnce bit tpnccr0 register ffffh 0001h 0000h tipn0 pin input capture trigger input 16-bit counter sampling clock (f xx ) capture trigger input (b) pulse width measurement mode 0000h ffffh ffffh 0002h 0000h count clock tpnce bit tpnccr0 register tipn0 pin input capture trigger input 16-bit counter sampling clock (f xx ) capture trigger input
preliminary user's manual u17714ej1v0ud 314 chapter 8 16-bit timer/event counter q (tmq) timer q (tmq) is a 16-bit timer/event counter. the v850es/jj2 incorporates tmq0. 8.1 overview an outline of tmq0 is shown below. ? clock selection: 8 ways ? capture/trigger input pins: 4 ? external event count input pins: 1 ? external trigger input pins: 1 ? timer/counters: 1 ? capture/compare registers: 4 ? capture/compare match interrupt request signals: 4 ? timer output pins: 4 8.2 functions tmq0 has the following functions. ? interval timer ? external event counter ? external trigger pulse output ? one-shot pulse output ? pwm output ? free-running timer ? pulse width measurement
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 315 8.3 configuration tmq0 includes the following hardware. table 8-1. configuration of tmq0 item configuration timer register 16-bit counter registers tmq0 capture/compare registers 0 to 3 (tq0ccr0 to tq0ccr3) tmq0 counter read buffer register (tq0cnt) ccr0 to ccr3 buffer registers timer inputs 4 (tiq00 note 1 to tiq03 pins) timer outputs 4 (toq00 to toq03 pins) control registers note 2 tmq0 control registers 0, 1 (tq0ctl0, tq0ctl1) tmq0 i/o control registers 0 to 2 (tq0ioc0 to tq0ioc2) tmq0 option register 0 (tq0opt0) notes 1. the tiq00 pin functions alternately as a capt ure trigger input signal, external event count input signal, and external trigger input signal. 2. when using the functions of the tiq00 to tiq03 and toq00 to toq03 pins, see table 4-19 using port pin as alternate-function pin . figure 8-1. block diagram of tmq0 tq0cnt tq0ccr0 tq0ccr1 tq0ccr2 toq00 inttq0ov ccr2 buffer register tq0ccr3 ccr3 buffer register toq01 toq02 toq03 inttq0cc0 inttq0cc1 inttq0cc2 inttq0cc3 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 tiq00 tiq01 tiq02 tiq03 selector internal bus internal bus selector edge detector ccr0 buffer register ccr1 buffer register 16-bit counter output controller clear remark f xx : main clock frequency
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 316 (1) 16-bit counter this 16-bit counter can count inte rnal clocks or external events. the count value of this counter can be read by using the tq0cnt register. when the tq0ctl0.tq0ce bit = 0, the va lue of the 16-bit counter is ffffh. if the tq0cnt register is read at this time, 0000h is read. reset sets the tq0ce bit to 0. therefor e, the 16-bit counter is set to ffffh. (2) ccr0 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr0 register is used as a compare regist er, the value written to the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttq0cc0) is generated. the ccr0 buffer register cannot be read or written directly. the ccr0 buffer register is cleared to 0000h after reset, as the tq0ccr0 register is cleared to 0000h. (3) ccr1 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr1 register is used as a compare regist er, the value written to the tq0ccr1 register is transferred to the ccr1 buffer register. when the count value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttq0cc1) is generated. the ccr1 buffer register cannot be read or written directly. the ccr1 buffer register is cleared to 0000h after reset, as the tq0ccr1 register is cleared to 0000h. (4) ccr2 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr2 register is used as a compare regist er, the value written to the tq0ccr2 register is transferred to the ccr2 buffer register. when the count value of the 16-bit counter matches the value of the ccr2 buffer register, a compare match interrupt request signal (inttq0cc2) is generated. the ccr2 buffer register cannot be read or written directly. the ccr2 buffer register is cleared to 0000h after reset, as the tq0ccr2 register is cleared to 0000h. (5) ccr3 buffer register this is a 16-bit compare register that com pares the count value of the 16-bit counter. when the tq0ccr3 register is used as a compare regist er, the value written to the tq0ccr3 register is transferred to the ccr3 buffer register. when the count value of the 16-bit counter matches the value of the ccr3 buffer register, a compare match interrupt request signal (inttq0cc3) is generated. the ccr3 buffer register cannot be read or written directly. the ccr3 buffer register is cleared to 0000h after reset, as the tq0ccr3 register is cleared to 0000h. (6) edge detector this circuit detects the valid edges input to the tiq 00 and tiq03 pins. no edge, rising edge, falling edge, or both the rising and falling edges can be selected as the valid edge by using the tq0ioc1 and tq0ioc2 registers. (7) output controller this circuit controls the output of the toq00 to toq 03 pins. the output contro ller is controlled by the tq0ioc0 register. (8) selector this selector selects the count clock for the 16-bit counter . eight types of internal clocks or an external event can be selected as the count clock.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 317 8.4 registers the registers that control tmq0 are as follows. ? tmq0 control register 0 (tq0ctl0) ? tmq0 control register 1 (tq0ctl1) ? tmq0 i/o control register 0 (tq0ioc0) ? tmq0 i/o control register 1 (tq0ioc1) ? tmq0 i/o control register 2 (tq0ioc2) ? tmq0 option register 0 (tq0opt0) ? tmq0 capture/compare register 0 (tq0ccr0) ? tmq0 capture/compare register 1 (tq0ccr1) ? tmq0 capture/compare register 2 (tq0ccr2) ? tmq0 capture/compare register 3 (tq0ccr3) ? tmq0 counter read buffer register (tq0cnt) remark when using the functions of the tiq00 to tiq03 and toq00 to toq03 pins, see table 4-19 using port pin as alternate-function pin .
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 318 (1) tmq0 control register 0 (tq0ctl0) the tq0ctl0 register is an 8-bit register that controls the operation of tmq0. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tq0ctl0 register by software. tq0ce tmq0 operation disabled (tmq0 reset asynchronously note ). tmq0 operation enabled. tmq0 operation started. tq0ce 0 1 tmq0 operation control tq0ctl0 0 0 0 0 tq0cks2 tq0cks1 tq0cks0 654321 after reset: 00h r/w address: fffff540h <7> 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 tq0cks2 0 0 0 0 1 1 1 1 internal count clock selection tq0cks1 0 0 1 1 0 0 1 1 tq0cks0 0 1 0 1 0 1 0 1 note tq0opt0.tq0ovf bit, 16-bit counter, timer output (toq00 to toq03 pins) cautions 1. set the tq0cks2 to tq0 cks0 bits when the tq0ce bit = 0. when the value of the tq0ce bi t is changed from 0 to 1, the tq0cks2 to tq0cks0 bits can be set simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 319 (2) tmq0 control register 1 (tq0ctl1) the tq0ctl1 register is an 8-bit register that controls the operation of tmq0. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tq0est 0 1 software trigger control tq0ctl1 tq0est tq0eee 0 0 tq0md2 tq0md1 tq0md0 <6> <5> 4 3 2 1 after reset: 00h r/w address: fffff541h generate a valid signal for external trigger input. ? in one-shot pulse output mode: a one-shot pulse is output with writing 1 to the tq0est bit as the trigger. ? in external trigger pulse output mode: a pwm waveform is output with writing 1 to the tq0est bit as the trigger. disable operation with external event count input. (perform counting with the count clock selected by the tq0ctl0.tq0ck0 to tq0ck2 bits.) tq0eee 0 1 count clock selection the tq0eee bit selects whether counting is performed with the internal count clock or the valid edge of the external event count input. 7 0 interval timer mode external event count mode external trigger pulse output mode one-shot pulse output mode pwm output mode free-running timer mode pulse width measurement mode setting prohibited tq0md2 0 0 0 0 1 1 1 1 timer mode selection tq0md1 0 0 1 1 0 0 1 1 tq0md0 0 1 0 1 0 1 0 1 enable operation with external event count input. (perform counting at the valid edge of the external event count input signal.) ? cautions 1. the tq0est bit is valid on ly in the external trigger pulse output mode or one-shot pulse output mode . in any other mode, writing 1 to this bit is ignored. 2. external event count input is selected in the external event count mode regardless of the value of the tq0eee bit. 3. set the tq0eee and tq0md2 to tq0md0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) the op eration is not guaranteed when rewriting is performed with the tq0ce bit = 1. if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 4. be sure to clear bits 3, 4, and 7 to ?0?.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 320 (3) tmq0 i/o control register 0 (tq0ioc0) the tq0ioc0 register is an 8-bit register that controls the timer output (toq00 to toq03 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0ol3 tq0olm 0 1 toq0m pin output level setting (m = 0 to 3) toq0m pin output inversion disabled toq0m pin output inversion enabled tq0ioc0 tq0oe3 tq0ol2 tq0oe2 tq0ol1 tq0oe1 tq0ol0 tq0oe0 <6> 5 <4> 3 <2> 1 after reset: 00h r/w address: fffff542h tq0oem 0 1 toq0m pin output setting (m = 0 to 3) timer output disabled ? when tq0olm bit = 0: low level is output from the toq0m pin ? when tq0olm bit = 1: high level is output from the toq0m pin 7 <0> timer output enabled (a square wave is output from the toq0m pin). cautions 1. rewrite the tq0olm and tq0oem bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. even if the tq0olm bit is manipulated when the tq0ce and tq0oem bits are 0, the toq0 m pin output level varies. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 321 (4) tmq0 i/o control register 1 (tq0ioc1) the tq0ioc1 register is an 8-bit register that controls the valid edge of the capture trigger input signals (tiq00 to tiq03 pins). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0is7 tq0is7 0 0 1 1 tq0is6 0 1 0 1 capture trigger input signal (tiq03 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tq0ioc1 tq0is6 tq0is5 tq0is4 tq0is3 tq0is2 tq0is1 tq0is0 654321 after reset: 00h r/w address: fffff543h tq0is5 0 0 1 1 tq0is4 0 1 0 1 capture trigger input signal (tiq02 pin) valid edge detection no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges 7 0 tq0is3 0 0 1 1 tq0is2 0 1 0 1 capture trigger input signal (tiq01 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges tq0is1 0 0 1 1 tq0is0 0 1 0 1 capture trigger input signal (tiq00 pin) valid edge setting no edge detection (capture operation invalid) detection of rising edge detection of falling edge detection of both edges cautions 1. rewrite the tq0is7 to tq0is0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. the tq0is7 to tq0is0 bi ts are valid only in the free- running timer mode and the pulse width measurement mode. in all other modes, a capture operation is not possible.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 322 (5) tmq0 i/o control register 2 (tq0ioc2) the tq0ioc2 register is an 8-bit register that controls the valid edge of the external event count input signal (tiq00 pin) and external trigger input signal (tiq00 pin). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 tq0ees1 0 0 1 1 tq0ees0 0 1 0 1 external event count input signal (tiq00 pin) valid edge setting no edge detection (external event count invalid) detection of rising edge detection of falling edge detection of both edges tq0ioc2 0 0 0 tq0ees1 tq0ees0 tq0ets1 tq0ets0 654321 after reset: 00h r/w address: fffff544h tq0ets1 0 0 1 1 tq0ets0 0 1 0 1 external trigger input signal (tiq00 pin) valid edge setting no edge detection (external trigger invalid) detection of rising edge detection of falling edge detection of both edges 7 0 cautions 1. rewrite the tq0ees1, tq0ees0, tq0ets1, and tq0ets0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. the tq0ees1 and tq0ees0 bits are valid only when the tq0ctl1.tq0eee bit = 1 or when the external event count mode (tq0ctl1.tq0md 2 to tq0ctl1.tq0md0 bits = 001) has been set. 3. the tq0ets1 and tq0ets0 bits are valid only when the external trigger pulse output mode (tq0ctl1.tq0md2 to tq0ctl1.tq0md0 bits = 010) or the one-shot pulse output mode (tq0ctl1.tq0 md2 to tq0ctl1.tq0md0 = 011) is set.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 323 (6) tmq0 option register 0 (tq0opt0) the tq0opt0 register is an 8-bit register used to set the capture/co mpare operation and detect an overflow. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. tq0ccs3 tq0ccsm 0 1 tq0ccrm register capture/compare selection the tq0ccsm bit setting is valid only in the free-running timer mode. compare register selected capture register selected tq0opt0 tq0ccs2 tq0ccs1 tq0ccs0 0 0 0 tq0ovf 654321 after reset: 00h r/w address: fffff545h tq0ovf set (1) reset (0) tmq0 overflow detection ? the tq0ovf bit is reset when the 16-bit counter count value overflows from ffffh to 0000h in the free-running timer mode or the pulse width measurement mode.  an interrupt request signal (inttq0ov) is generated at the same time that the tq0ovf bit is set to 1. the inttq0ov signal is not generated in modes other than the free-running timer mode and the pulse width measurement mode.  the tq0ovf bit is not cleared even when the tq0ovf bit or the tq0opt0 register are read when the tq0ovf bit = 1.  the tq0ovf bit can be both read and written, but the tq0ovf bit cannot be set to 1 by software. writing 1 has no influence on the operation of tmq0. overflow occurred tq0ovf bit 0 written or tq0ctl0.tq0ce bit = 0 7 <0> cautions 1. rewrite the tq0ccs 3 to tq0ccs0 bits when the tq0ctl0.tq0ce bit = 0. (the same value can be written when the tq0ce bit = 1.) if rewriting was mistakenly performed, clear the tq0ce bit to 0 and then set the bits again. 2. be sure to clear bits 1 to 3 to ?0?. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 324 (7) tmq0 capture/compare register 0 (tq0ccr0) the tq0ccr0 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs0 bit. in the pulse width measurement mode, the tq0ccr0 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr0 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr0 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr0 12 10 8 6 4 2 after reset: 0000h r/w address: fffff546h 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 325 (a) function as compare register the tq0ccr0 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the value of the 16-bit counter matches the value of the ccr0 buffer register, a compare match interrupt request signal (inttq0cc0) is generated. if toq00 pin output is e nabled at this time, the output of the toq00 pin is inverted. when the tq0ccr0 register is used as a cycle register in the interval timer mode, external event count mode, external trigger pulse output mode, one-shot pulse output mode, or pwm output mode, the value of the 16-bit counter is cleared (0000h) if its count va lue matches the value of the ccr0 buffer register. (b) function as capture register when the tq0ccr0 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr0 register if the valid ed ge of the capture trigger input pin (tiq00 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr0 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq00 pin) is detected. even if the capture operation and reading the tq0c cr0 register conflict, the correct value of the tq0ccr0 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-2. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 326 (8) tmq0 capture/compare register 1 (tq0ccr1) the tq0ccr1 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs1 bit. in the pulse width measurement mode, the tq0ccr1 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr1 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr1 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr1 12 10 8 6 4 2 after reset: 0000h r/w address: fffff548h 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 327 (a) function as compare register the tq0ccr1 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr1 register is transferred to the ccr1 buffer register. when the value of the 16-bit counter matches the value of the ccr1 buffer register, a compare match interrupt request signal (inttq0cc1) is generated. if toq01 pin output is e nabled at this time, the output of the toq01 pin is inverted. (b) function as capture register when the tq0ccr1 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr1 register if the valid ed ge of the capture trigger input pin (tiq01 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr1 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq01 pin) is detected. even if the capture operation and reading the tq0c cr1 register conflict, the correct value of the tq0ccr1 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-3. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 328 (9) tmq0 capture/compare register 2 (tq0ccr2) the tq0ccr2 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs2 bit. in the pulse width measurement mode, the tq0ccr2 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr2 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr2 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr2 12 10 8 6 4 2 after reset: 0000h r/w address: fffff54ah 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 329 (a) function as compare register the tq0ccr2 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr2 register is transferred to the ccr2 buffer register. when the value of the 16-bit counter matches the value of the ccr2 buffer register, a compare match interrupt request signal (inttq0cc2) is generated. if toq02 pin output is e nabled at this time, the output of the toq02 pin is inverted. (b) function as capture register when the tq0ccr2 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr2 register if the valid ed ge of the capture trigger input pin (tiq02 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr2 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq02 pin) is detected. even if the capture operation and reading the tq0c cr2 register conflict, the correct value of the tq0ccr2 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-4. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 330 (10) tmq0 capture/compare register 3 (tq0ccr3) the tq0ccr3 register can be used as a capture register or a com pare register depending on the mode. this register can be used as a capture register or a compare register only in the free-running timer mode, depending on the setting of the tq0o pt0.tq0ccs3 bit. in the pulse width measurement mode, the tq0ccr3 register can be used only as a capture register. in any other m ode, this register can be used only as a compare register. the tq0ccr3 register can be r ead or written during operation. this register can be read or written in 16-bit units. reset sets this register to 0000h. caution accessing the tq0ccr3 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0ccr3 12 10 8 6 4 2 after reset: 0000h r/w address: fffff54ch 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 331 (a) function as compare register the tq0ccr3 register can be rewritten even when the tq0ctl0.tq0ce bit = 1. the set value of the tq0ccr3 register is transferred to the ccr3 buffer register. when the value of the 16-bit counter matches the value of the ccr3 buffer register, a compare match interrupt request signal (inttq0cc3) is generated. if toq03 pin output is e nabled at this time, the output of the toq03 pin is inverted. (b) function as capture register when the tq0ccr3 register is used as a capture register in the free- running timer mode, the count value of the 16-bit counter is stored in the tq0ccr3 register if the valid ed ge of the capture trigger input pin (tiq03 pin) is detected. in the pulse-width measurement mode, the co unt value of the 16-bit counter is stored in the tq0ccr3 register and the 16-bit counter is cleared (0000h) if the valid edge of the capture trigger input pin (tiq03 pin) is detected. even if the capture operation and reading the tq0c cr3 register conflict, the correct value of the tq0ccr3 register can be read. the following table shows the functions of the capture/compare re gister in each mode, and how to write data to the compare register. table 8-5. function of capture/co mpare register in each mode a nd how to write compare register operation mode capture/compare register how to write compare register interval timer compare register anytime write external event counter compare register anytime write external trigger pulse output compare register batch write one-shot pulse output compare register anytime write pwm output compare register batch write free-running timer capture/compare register anytime write pulse width measurement capture register ?
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 332 (11) tmq0 counter read buffer register (tq0cnt) the tq0cnt register is a read buffer register that can read the count va lue of the 16-bit counter. if this register is read when the tq0ctl0.tq0ce bit = 1, the count value of the 16-bit timer can be read. this register is read-only, in 16-bit units. the value of the tq0cnt register is cleared to 0000h when the tq0ce bit = 0. if the tq0cnt register is read at this time, the value of the 16-bit count er (ffffh) is not read, but 0000h is read. the value of the tq0cnt register is cleared to 0000h after reset, as the tq0ce bit is cleared to 0. caution accessing the tq0cnt register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock tq0cnt 12 10 8 6 4 2 after reset: 0000h r address: fffff54eh 14 0 13 11 9 7 5 3 15 1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 333 8.5 operation tmq0 can perform the following operations. operation tq0ctl1.tq0est bit (software trigger bit) tiq00 pin (external trigger input) capture/compare register setting compare register write interval timer mode invalid invalid compare only anytime write external event count mode note 1 invalid invalid compare only anytime write external trigger pulse output mode note 2 valid valid compare only batch write one-shot pulse output mode note 2 valid valid compare only anytime write pwm output mode invalid invalid compare only batch write free-running timer mode invalid invalid switching enabled anytime write pulse width measurement mode note 2 invalid invalid capture only not applicable notes 1. to use the external event count m ode, specify that the valid edge of the tiq00 pin capture trigger input is not detected (by clearing the tq0ioc1.tq 0is1 and tq0ioc1.tq0is0 bits to "00"). 2. when using the external trigger pulse output m ode, one-shot pulse output mode, and pulse width measurement mode, select the internal clock as the count clock (by cleari ng the tq0ctl1.tq0eee bit to 0).
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 334 8.5.1 interval timer mode (t q0md2 to tq0md0 bits = 000) in the interval timer mode, an interrupt request signal (inttq0cc0) is generated at t he specified interval if the tq0ctl0.tq0ce bit is set to 1. a square wave whose hal f cycle is equal to the interval can be output from the toq00 pin. usually, the tq0ccr1 to tq0ccr3 registers are not used in the interval timer mode. figure 8-2. configuration of interval timer 16-bit counter output controller ccr0 buffer register tq0ce bit tq0ccr0 register count clock selection clear match signal toq00 pin inttq0cc0 signal figure 8-3. basic timing of operation in interval timer mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal d 0 d 0 d 0 d 0 d 0 interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1) interval (d 0 + 1)
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 335 when the tq0ce bit is set to 1, the va lue of the 16-bit counter is cleared fr om ffffh to 0000h in synchronization with the count clock, and the counter starts counting. at this time, the output of the toq00 pin is inverted. additionally, the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer register, the 16-bit counter is cleared to 0000h, the output of the toq00 pin is in verted, and a compare match interrupt request signal (inttq0cc0) is generated. the interval can be calculated by the following expression. interval = (set value of tq0ccr0 register + 1) count clock cycle figure 8-4. register setting for in terval timer mode operation (1/2) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 note 00 tq0ctl1 0, 0, 0: interval timer mode 000 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0: operate on count clock selected by bits tq0cks0 to tq0cks2 1: count with external event count input signal note this bit can be set to 1 only when the interrupt request signals (inttq0cc0 and inttq0cck) are masked by the interrupt mask flags (tq0ccmk0 to tq0ccmkk) and the timer output (toq0k) is performed at the same time. however, the tq0ccr0 and tq0ccrk registers must be set to the same value (see 8.5.1 (2) (d) operation of tq 0ccr1 to tq0ccr3 registers ) (k = 1 to 3).
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 336 figure 8-4. register setting for in terval timer mode operation (2/2) (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of output level with operation of toq00 pin disabled 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output setting of output level with operation of toq01 pin disabled 0: low level 1: high level 0/1 0/1 0/1 tq0oe1 tq0ol0 tq0oe0 tq0ol1 0: disable toq02 pin output 1: enable toq02 pin output setting of output level with operation of toq02 pin disabled 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output setting of output level with operation of toq03 pin disabled 0: low level 1: high level tq0oe3 tq0ol2 tq0oe2 tq0ol3 (d) tmq0 counter read buffer register (tq0cnt) by reading the tq0cnt register, the count va lue of the 16-bit counter can be read. (e) tmq0 capture/compare register 0 (tq0ccr0) if the tq0ccr0 register is set to d 0 , the interval is as follows. interval = (d 0 + 1) count clock cycle (f) tmq0 capture/compare register s 1 to 3 (tq0ccr1 to tq0ccr3) usually, the tq0ccr1 to tq0ccr3 registers are not us ed in the interval timer mode. however, the set value of the tq0ccr1 to tq0ccr3 registers are trans ferred to the ccr1 to ccr3 buffer registers. the compare match interrupt request signals (inttq0cc1 to inttq0ccr3) is generated when the count value of the 16-bit counter matches the va lue of the ccr1 to ccr3 buffer registers. therefore, mask the interrupt request by using the corresponding interrupt mask flags (tq0ccmk1 to tq0ccmk3). remark tmq0 i/o control register 1 (tq0ioc1), tmq0 i/o control register 2 (tq0ioc2), and tmq0 option register 0 (tq0opt0) are not used in the interval timer mode.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 337 (1) interval timer mode operation flow figure 8-5. software processing flow in interval timer mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal d 0 d 0 d 0 d 0 <1> <2> tq0ce bit = 1 tq0ce bit = 0 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ccr0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 338 (2) interval timer mode operation timing (a) operation if tq0ccr0 re gister is set to 0000h if the tq0ccr0 register is set to 0000h, the inttq 0cc0 signal is generated at each count clock subsequent to the first count clock, and t he output of the toq00 pin is inverted. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal 0000h interval time count clock cycle interval time count clock cycle ffffh 0000h 0000h 0000h 0000h (b) operation if tq0ccr0 re gister is set to ffffh if the tq0ccr0 register is set to ffffh, the 16-bit co unter counts up to ffffh. the counter is cleared to 0000h in synchronization with the next count-up timing. the inttq0cc0 signal is generated and the output of the toq00 pin is inverted. at this time, an overflow interrupt request signal (inttq0ov) is not generated, nor is the overflow flag (tq0opt0.tq0ovf bit) set to 1. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal ffffh interval time 10000h count clock cycle interval time 10000h count clock cycle interval time 10000h count clock cycle
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 339 (c) notes on rewriting tq0ccr0 register to change the value of the tq0ccr0 register to a smaller value, stop counting once and then change the set value. if the value of the tq0ccr0 register is rewritten to a smaller value duri ng counting, the 16-bit counter may overflow. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register tq0ol0 bit toq00 pin output inttq0cc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 l interval time (1) interval time (ng) interval time (2) remark interval time (1): (d 1 + 1) count clock cycle interval time (ng): (10000h + d 2 + 1) count clock cycle interval time (2): (d 2 + 1) count clock cycle if the value of the tq0ccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tq0ccr0 register has been rewritten. consequently, the value of the 16-bit counter that is compared is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttq0cc0 signal is generated and the output of the toq00 pin is inverted. therefore, the inttq0cc0 signal may not be generated at the interval time "(d 1 + 1) count clock cycle" or "(d 2 + 1) count clock cycle" originally expected, but may be generated at an interval of "(10000h + d 2 + 1) count clock period".
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 340 (d) operation of tq0ccr1 to tq0ccr3 registers figure 8-6. configuration of tq0ccr1 to tq0ccr3 registers ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal tq0ccr3 register ccr3 buffer register match signal toq02 pin inttq0cc2 signal tq0ccr2 register ccr2 buffer register match signal output controller count clock selection output controller output controller output controller 16-bit counter
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 341 if the set value of the tq0ccrk register is less than the set value of the tq0ccr0 register, the inttq0cck signal is generated once per cycle. at t he same time, the output of the topq0k pin is inverted. the toq0k pin outputs a square wave with the sa me cycle as that output by the toq00 pin. remark k = 1 to 3 figure 8-7. timing chart when d 01 d k1 d 01 d 11 d 21 d 31 d 21 d 11 d 31 d 01 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal tq0ccr1 register toq01 pin output inttq0cc1 signal tq0ccr2 register toq02 pin output inttq0cc2 signal tq0ccr3 register toq03 pin output inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 342 if the set value of the tq0ccrk regi ster is greater than the set value of the tq0ccr0 register, the count value of the 16-bit counter does not match the value of the tq0ccr k register. consequently, the inttq0cck signal is not generated, nor is the output of the toq0k pin changed. remark k = 1 to 3 figure 8-8. timing chart when d 01 < d k1 d 01 d 11 d 21 l l l d 31 d 01 d 01 d 01 d 01 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register toq00 pin output inttq0cc0 signal tq0ccr1 register toq01 pin output inttq0cc1 signal tq0ccr2 register toq02 pin output inttq0cc2 signal tq0ccr3 register toq03 pin output inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 343 8.5.2 external event count mode (tq0md2 to tq0md0 bits = 001) in the external event count mode, the valid edge of the external event count input is counted when the tq0ctl0.tq0ce bit is set to 1, and an interrupt request signal (inttq0cc0) is generated each time the specified number of edges have been counted . the toq00 pin cannot be used. usually, the tq0ccr1 to tq0ccr3 registers are not used in the external event count mode. figure 8-9. configuration in external event count mode 16-bit counter ccr0 buffer register tq0ce bit tq0ccr0 register edge detector clear match signal inttq0cc0 signal tiq00 pin (external event count input) figure 8-10. basic timing in external event count mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 0 d 0 d 0 d 0 16-bit counter tq0ccr0 register nttq0cc0 signal external event count input (tiq00 pin input) d 0 external event count interval (d 0 + 1) d 0 ? 1d 0 0000 0001 external event count interval (d 0 + 1) external event count interval (d 0 + 1) remark this figure shows the basic timing when the risi ng edge is specified as the valid edge of the external event count input.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 344 when the tq0ce bit is set to 1, the value of the 16-bit count er is cleared from ffffh to 0000h. the counter counts each time the valid edge of external event count input is detec ted. additionally, the set value of the tq0ccr0 register is transferred to the ccr0 buffer register. when the count value of the 16-bit counter matches the valu e of the ccr0 buffer register, the 16-bit counter is cleared to 0000h, and a compare match interrupt request signal (inttq0cc0) is generated. the inttq0cc0 signal is generated each time the valid edge of the external event co unt input has been detected (set value of tq0ccr0 register + 1) times. figure 8-11. register setting for operati on in external event count mode (1/2) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 0: stop counting 1: enable counting 000 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 00000 tq0ctl1 0, 0, 1: external event count mode 001 tq0md2 tq0md1 tq0md0 tq0eee tq0est (c) tmq0 i/o control register 0 (tq0ioc0) 00000 tq0ioc0 0: disable toq00 pin output 0: disable toq01 pin output 000 tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 0: disable toq02 pin output 0: disable toq03 pin output (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the count value of the 16-bit counter can be read by reading the tq0cnt register.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 345 figure 8-11. register setting for operati on in external event count mode (2/2) (f) tmq0 capture/compare register 0 (tq0ccr0) if d 0 is set to the tq0ccr0 regist er, the counter is cleared and a compare match interrupt request signal (inttq0cc0) is generated when the nu mber of external event counts reaches (d 0 + 1). (g) tmq0 capture/compare regist ers 1 to 3 (tq0ccr1 to tq0ccr3) usually, the tq0ccr1 to tq0ccr3 registers are not us ed in the external event count mode. however, the set value of the tq0ccr1 to tq0ccr3 regist ers are transferred to the ccr1 to ccr3 buffer registers. when the count value of the 16-bit counter matches the value of the ccr1 to ccr3 buffer registers, compare match interrupt request si gnals (inttq0cc1 to inttq0cc3) are generated. therefore, mask the interrupt signal by using t he interrupt mask flags (t q0ccmk1 to tq0ccmk3). remark the tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the external event count mode.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 346 (1) external event count mode operation flow figure 8-12. flow of software processing in external event count mode ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 0 d 0 d 0 d 0 <1> <2> tq0ce bit = 1 tq0ce bit = 0 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 347 (2) operation timing in external event count mode cautions 1. in the external event count mode , do not set the tq0ccr0 register to 0000h. 2. in the external e vent count mode, use of the timer output is disabled. if performing timer output using external event count input, set the interval timer mode, and select the operation enabled by the external event count input for the count clock (tq0ctl1.tq0md2 to tq0ctl1.tq0md0 bits = 000, tq0ctl1.tq0eee bit = 1). (a) operation if tq0ccr0 re gister is set to ffffh if the tq0ccr0 register is set to ffffh, the 16-bit counter counts to ffffh each time the valid edge of the external event count signal has been detected. the 16-bit counter is cleared to 0000h in synchronization with the next count-up timing, and the in ttq0cc0 signal is generated. at this time, the tq0opt0.tq0ovf bit is not set. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal ffffh external event count signal interval external event count signal interval external event count signal interval
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 348 (b) notes on rewriting the tq0ccr0 register to change the value of the tq0ccr0 register to a smaller value, stop counting once and then change the set value. if the value of the tq0ccr0 register is rewritten to a smaller value duri ng counting, the 16-bit counter may overflow. ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal d 1 d 2 d 1 d 1 d 2 d 2 d 2 external event count signal interval (1) (d 1 + 1) external event count signal interval (ng) (10000h + d 2 + 1) external event count signal interval (2) (d 2 + 1) if the value of the tq0ccr0 register is changed from d 1 to d 2 while the count value is greater than d 2 but less than d 1 , the count value is transferred to the ccr0 buff er register as soon as the tq0ccr0 register has been rewritten. consequently, the value t hat is compared with the 16-bit counter is d 2 . because the count value has already exceeded d 2 , however, the 16-bit c ounter counts up to ffffh, overflows, and then counts up again from 0000h. when the count value matches d 2 , the inttq0cc0 signal is generated. therefore, the inttq0cc0 signal may not be generated at the valid edge count of "(d 1 + 1) times" or "(d 2 + 1) times" originally expected, but may be generated at the valid edge count of "(10000h + d 2 + 1) times".
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 349 (c) operation of tq0ccr1 to tq0ccr3 registers figure 8-13. configuration of tq0ccr1 to tq0ccr3 registers ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal inttq0cc3 signal tiq00 pin tq0ccr1 register ccr1 buffer register match signal inttq0cc1 signal tq0ccr3 register ccr3 buffer register match signal inttq0cc2 signal tq0ccr2 register ccr2 buffer register match signal 16-bit counter edge detector
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 350 if the set value of the tq0ccrk register is smalle r than the set value of the tq0ccr0 register, the inttq0cck signal is generated once per cycle. remark k = 1 to 3 figure 8-14. timing chart when d 01 d k1 d 01 d 11 d 21 d 31 d 21 d 11 d 31 d 01 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 d 01 d 21 d 11 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal tq0ccr1 register inttq0cc1 signal tq0ccr2 register inttq0cc2 signal tq0ccr3 register inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 351 if the set value of the tq0ccrk regi ster is greater than the set va lue of the tq0ccr0 register, the inttq0cck signal is not generated because the count va lue of the 16-bit counter and the value of the tq0ccrk register do not match. remark k = 1 to 3 figure 8-15. timing chart when d 01 < d k1 d 01 d 11 d 21 l l l d 31 d 01 d 01 d 01 d 01 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal tq0ccr1 register inttq0cc1 signal tq0ccr2 register inttq0cc2 signal tq0ccr3 register inttq0cc3 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 352 8.5.3 external trigger pulse output m ode (tq0md2 to tq0md0 bits = 010) in the external trigger pulse output mode, 16-bit ti mer/event counter q waits for a trigger when the tq0ctl0.tq0ce bit is set to 1. when the valid edge of an external trigger input signal is detected, 16-bit timer/event counter q starts counting, and outputs a pwm waveform from the toq01 to toq03 pins. pulses can also be output by generating a software trigger instead of using the external trigger. when using a software trigger, a square wave that has one cycle of the pwm waveform as half its cycle can also be output from the toq00 pin. figure 8-16. configuration in external trigger pulse output mode ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin tiq00 pin transfer s r tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer s r tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal s r tq0ccr2 register ccr2 buffer register match signal 16-bit counter count clock selection count start control edge detector software trigger generation output controller (rs-ff) output controller output controller (rs-ff) output controller
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 353 figure 8-17. basic timing in exte rnal trigger pulse output mode d 1 d 2 d 3 d 1 d 2 d 3 d 1 d 2 d 3 d 1 d 1 d 2 d 3 active level width (d 2 ) active level width (d 2 ) active level width (d 2 ) active level width (d 3 ) active level width (d 3 ) cycle (d 0 + 1) cycle (d 0 + 1) wait for trigger active level width (d 3 ) cycle (d 0 + 1) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) d 0 d 1 d 3 d 2 d 0 d 0 d 0 d 0
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 354 16-bit timer/event counter q waits for a trigger when the tq0ce bit is set to 1. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts count ing at the same time, and out puts a pwm waveform from the toq0k pin. if the trigger is generated again while the counter is operating, the c ounter is cleared to 0000h and restarted. (the output of the toq00 pin is inverted. the toq0k pin outputs a high-level regar dless of the status (high/low) when a trigger is generated.) the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tq0ccrk register) count clock cycle cycle = (set value of tq0ccr0 register + 1) count clock cycle duty factor = (set value of tq0ccrk regist er)/(set value of tq0ccr0 register + 1) the compare match request signal inttq0 cc0 is generated when the 16-bit c ounter counts next time after its count value matches the value of the cc r0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttq0cck is generated when the count value of the 16-bit counter matches the value of the ccrk buffer register. the value set to the tq0ccrm register is transferred to the ccrm buffer register w hen the count value of the 16- bit counter matches the value of the ccr0 buffer r egister and the 16-bit counter is cleared to 0000h. the valid edge of an external trigger input signal, or se tting the software trigger (tq0ctl1.tq0est bit) to 1 is used as the trigger. remark k = 1 to 3, m = 0 to 3 figure 8-18. setting of registers in exte rnal trigger pulse output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce note the setting is invalid when the tq0ctl1.tq0eee bit = 1.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 355 figure 8-18. setting of registers in exte rnal trigger pulse output mode (2/3) (b) tmq0 control register 1 (tq0ctl1) 0 0/1 0/1 0 0 tq0ctl1 0: operate on count clock selected by tq0cks0 to tq0cks2 bits 1: count with external event input signal generate software trigger when 1 is written 010 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0, 1, 0: external trigger pulse output mode (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of output level while operation of toq00 pin is disabled 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output specification of active level of toq01 pin output 0: active-high 1: active-low 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 specification of active level of toq03 pin output 0: active-high 1: active-low 0: disable toq02 pin output 1: enable toq02 pin output specification of active level of toq02 pin output 0: active-high 1: active-low 0: disable toq03 pin output 1: enable toq03 pin output note clear this bit to 0 when the toq00 pin is not used in the external trigger pulse output mode.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 356 figure 8-18. setting of registers in exte rnal trigger pulse output mode (3/3) (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external trigger input select valid edge of external event count input 0/1 0/1 0/1 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) if d 0 is set to the tq0ccr0 register, d 1 to the tq0ccr1 register, d 2 to the tq0ccr2 register, and d 3 , to the tq0ccr3 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle toq01 pin pwm waveform active level width = d 1 count clock cycle toq02 pin pwm waveform active level width = d 2 count clock cycle toq03 pin pwm waveform active level width = d 3 count clock cycle remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the external trigger pulse output mode. 2. updating tmq0 capture/compare register 2 (tq0ccr2) and tmq0 capture/compare register 3 (tq0ccr3) is validated by writing tmq0 capture/compare register 1 (tq0ccr1).
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 357 (1) operation flow in extern al trigger pulse output mode figure 8-19. software processing flow in ex ternal trigger pulse output mode (1/2) d 10 d 10 d 10 d 20 d 30 d 00 d 11 d 21 d 01 d 31 d 11 d 21 d 00 d 31 d 20 d 30 d 00 d 21 d 00 d 31 d 11 d 21 d 00 d 31 ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register ccr0 buffer register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output d 00 d 01 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 10 d 11 d 10 d 11 d 10 d 11 d 20 d 21 d 20 d 21 d 20 d 21 d 21 d 30 d 31 d 30 d 31 d 30 d 31 d 30 d 31 <1> <2> <3> <4> <5> <6> <7> d 11 d 11 d 20 d 10
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 358 figure 8-19. software processing flow in ex ternal trigger pulse output mode (2/2) start <1> count operation start flow tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. writing of the tq0ccr1 register must be performed when the set duty factor is only changed after writing the tq0ccr2 and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. tq0ccr1 register writing of the same value is necessary only when the set duty factor of toq02 and toq03 pin outputs is changed. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed. when counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. counting is stopped. the tq0cks0 to tq0cks2 bits can be set at the same time when counting is enabled (tq0ce bit = 1). trigger wait status writing of the tq0ccr1 register must be performed after writing the tq0ccr0, tq0ccr2, and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer registers. tq0ccr1 register writing of the same value is necessary only when the set cycle is changed. <2> tq0ccr0 to tq0ccr3 register setting change flow <3> tq0ccr0 register setting change flow <4> tq0ccr1 to tq0ccr3 register setting change flow <5> tq0ccr2, tq0ccr3 register setting change flow <6> tq0ccr1 register setting change flow <7> count operation stop flow tq0ce bit = 0 setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register stop setting of tq0ccr1 register setting of tq0ccr0 register setting of tq0ccr1 register setting of tq0ccr0, tq0ccr2, and tq0ccr3 registers tq0ccr1 register when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 359 (2) external trigger pulse output mode operation timing (a) note on changing pulse width during operation to change the pwm waveform while the counter is operating, write the tq0ccr1 register last. rewrite the tq0ccrk register after writing the tq0ccr1 register after the inttq0cc0 signal is detected. ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) d 30 d 00 d 01 d 30 d 30 d 20 d 20 d 20 d 21 d 11 d 00 d 00 d 31 d 01 d 01 d 21 d 11 d 31 tq0ccr0 register ccr0 buffer register inttq0cc0 signal tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output toq00 pin output (only when software trigger is used) d 10 d 10 d 10 d 00 d 11 d 10 d 11 d 10 d 21 d 20 d 21 d 20 d 31 d 30 d 31 d 30 d 00 d 01
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 360 in order to transfer data from the tq0ccrm register to the ccrm buffer register, the tq0ccr1 register must be written. to change both the cycle and active level width of the pwm waveform at this time, first set the cycle to the tq0ccr0 register, set the active level width to t he tq0ccr2 and tq0ccr3 registers, and then set an active level to the tq0ccr1 register. to change only the cycle of the pwm waveform, first set the cycle to the tq0ccr0 register, and then write the same value to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform, first set an active level to the tq0ccr2 and tq0ccr3 registers and then set an active level to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform output by the toq01 pin, only the tq0ccr1 register has to be set. to change only the active level width (duty factor) of the pwm waveform output by the toq02 and toq03 pins, first set an active level width to the tq0 ccr2 and tq0ccr3 registers, and then write the same value to the tq0ccr1 register. after data is written to the tq0ccr1 register, the value written to the tq0ccrm register is transferred to the ccrm buffer register in synchronization with clea ring of the 16-bit counter, and is used as the value compared with the 16-bit counter. to write the tq0ccr0 to tq0ccr3 registers again afte r writing the tq0ccr1 register once, do so after the inttq0cc0 signal is generated. otherwise, t he value of the ccrm buffer register may become undefined because timing of transferring data from t he tq0ccrm register to the ccrm buffer register conflicts with writing the tq0ccrm register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 361 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tq0ccrk register to 0000h. if the set value of the tq0ccr0 register is ffffh, the inttq0cck signal is generated periodically. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 l remark k = 1 to 3 to output a 100% waveform, set a value of (set value of tq0ccr0 register + 1) to the tq0ccrk register. if the set value of the tq0ccr0 register is ffffh, 100% output cannot be produced. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 362 (c) conflict between trigger detection and match with ccrk buffer register if the trigger is detected immediately after the inttq 0cck signal is generated, the 16-bit counter is immediately cleared to 0000h, the output signal of t he toq0k pin is asserted, and the counter continues counting. consequently, the inactive peri od of the pwm waveform is shortened. 16-bit counter ccrk buffer register inttq0cck signal toq0k pin output external trigger input (tiq00 pin input) d k d k ? 1 0000 ffff 0000 shortened d k remark k = 1 to 3 if the trigger is detected immediately before the in ttq0cck signal is generated, the inttq0cck signal is not generated, and the 16-bit counter is cleared to 0000h and continues counting. t he output signal of the toq0k pin remains active. consequently, the active period of the pwm waveform is extended. 16-bit counter ccrk buffer register inttq0cck signal toq0k pin output external trigger input (tiq00 pin input) d k d k ? 2d k ? 1d k 0000 ffff 0000 0001 extended remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 363 (d) conflict between trigger detection and match with ccr0 buffer register if the trigger is detected immediately after the inttq 0cc0 signal is generated, the 16-bit counter is cleared to 0000h and continues counting up. therefore, the active period of the toq0k pin is extended by time from generation of the inttq0cc0 signal to trigger detection. 16-bit counter ccr0 buffer register inttq0cc0 signal toq0k pin output external trigger input (tiq00 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0000 extended remark k = 1 to 3 if the trigger is detected immediately before the in ttq0cc0 signal is generated, the inttq0cc0 signal is not generated. the 16-bit counter is cleared to 0000h, the toq0k pin is asserted, and the counter continues counting. consequently, the inactive period of the pwm waveform is shortened. 16-bit counter ccr0 buffer register inttq0cc0 signal toq0k pin output external trigger input (tiq00 pin input) d 0 d 0 ? 1d 0 0000 ffff 0000 0001 shortened remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 364 (e) generation timing of compare match interrupt request signal (inttq0cck) the timing of generation of the inttq 0cck signal in the external trigger pulse output mode differs from the timing of other inttq0cck signals; the inttq0cck signal is generated when the count value of the 16-bit counter matches the value of the ccrk buffer register. count clock 16-bit counter ccrk buffer register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 remark k = 1 to 3 usually, the inttq0cck signal is generated in synchro nization with the next count up after the count value of the 16-bit counter matches the va lue of the ccrk buffer register. in the external trigger pulse output mode, however, it is generated one clock earlier. this is because the timing is changed to match the timing of cha nging the output signal of the toq0k pin.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 365 8.5.4 one-shot pulse output mode (tq0md2 to tq0md0 bits = 011) in the one-shot pulse output mode, 16-bit timer/event coun ter q waits for a trigger when the tq0ctl0.tq0ce bit is set to 1. when the valid edge of an external trigger input is detected, 16-bit timer/event counter q starts counting, and outputs a one-shot pulse from the toq01 to toq03 pins. instead of the external trigger, a software trigger can also be generated to output the pulse. when the software trigger is used, the toq00 pin outputs t he active level while the 16-bit counter is counting, and the inactive level when the counter is stopped (waiting for a trigger). figure 8-20. configuration in one-shot pulse output mode ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin tiq00 pin transfer s r s r tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer s r tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal s r tq0ccr2 register ccr2 buffer register match signal 16-bit counter count clock selection count start control edge detector software trigger generation output controller (rs-ff) output controller (rs-ff) output controller (rs-ff) output controller (rs-ff)
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 366 figure 8-21. basic timing in one-shot pulse output mode d 0 d 1 d 2 d 3 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 1 ) active level width (d 0 ? d 1 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 2 ) active level width (d 0 ? d 2 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) delay (d 3 ) active level width (d 0 ? d 3 + 1) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output toq00 pin output (only when software trigger is used)
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 367 when the tq0ce bit is set to 1, 16-bit timer/event counter q waits for a trigger. when the trigger is generated, the 16-bit counter is cleared from ffffh to 0000h, starts counti ng, and outputs a o ne-shot pulse from the toq0k pin. after the one-shot pulse is output, the 16-bit counter is set to ffffh, stops counting, and waits for a trigger. if a trigger is generated again while the one-s hot pulse is being output, it is ignored. the output delay period and active level width of the one-shot pulse can be calculated as follows. output delay period = (set value of tq0ccrk register) count clock cycle active level width = (set value of tq0ccr0 register ? set value of tq0ccrk register + 1) count clock cycle the compare match interrupt request signal inttq0cc0 is generated when the 16-bit counter counts after its count value matches the value of the ccr0 buffer register. the compare match interrupt request signal inttq0cck is generated when the count value of the 16-bit counter matches the va lue of the ccrk buffer register. the valid edge of an external trigger input or setting the software trigger (tq0ctl1.tq0est bit) to 1 is used as the trigger. remark k = 1 to 3 figure 8-22. setting of registers in one-shot pulse output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 0 0/1 0/1 0 0 tq0ctl1 0: operate on count clock selected by tq0cks0 to tq0cks2 bits 1: count external event input signal generate software trigger when 1 is written 011 tq0md2 tq0md1 tq0md0 tq0eee tq0est 0, 1, 1: one-shot pulse output mode note the setting is invalid when the tq0ctl1.tq0eee bit = 1.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 368 figure 8-22. register setting in one-shot pulse output mode (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of output level while operation of toq00 pin is disabled 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output specification of active level of toq01 pin output 0: active-high 1: active-low 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 specification of active level of toq03 pin output 0: active-high 1: active-low 0: disable toq02 pin output 1: enable toq02 pin output specification of active level of toq02 pin output 0: active-high 1: active-low 0: disable toq03 pin output 1: enable toq03 pin output (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external trigger input select valid edge of external event count input 0/1 0/1 0/1 tq0ees0 tq0ets1 tq0ets0 tq0ees1 note clear this bit to 0 when the toq00 pin is not used in the one-shot pulse output mode.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 369 figure 8-22. register setting in one-shot pulse output mode (3/3) (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) if d 0 is set to the tq0ccr0 register and d k to the tq0ccrk register, the active level width and output delay period of the one-shot pulse are as follows. active level width = (d k ? d 0 + 1) count clock cycle output delay period = (d k ) count clock cycle remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the one-shot pulse output mode. 2. k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 370 (1) operation flow in one-shot pulse output mode figure 8-23. software processing flow in one-shot pulse output mode (1/2) ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output d 00 d 01 d 11 d 10 d 21 d 20 d 31 d 30 d 10 d 20 d 30 d 11 d 21 d 31 d 00 d 01 <3> <1> <2>
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 371 figure 8-23. software processing flow in one-shot pulse output mode (2/2) tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). trigger wait status start <1> count operation start flow tq0ce bit = 0 count operation is stopped stop <3> count operation stop flow setting of tq0ccr0 to tq0ccr3 registers as rewriting the tq0ccrm register immediately forwards to the ccrm buffer register, rewriting immediately after the generation of the inttq0ccr0 signal is recommended. <2> tq0ccr0 to tq0ccr3 register setting change flow remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 372 (2) operation timing in one-shot pulse output mode (a) note on rewriti ng tq0ccrm register to change the set value of the tq0ccrm register to a smaller value, stop counting once, and then change the set value. if the value of the tq0ccr0 register is rewritten to a smaller value duri ng counting, the 16-bit counter may overflow. d k0 d k1 d 01 d 01 d 00 d k1 d 01 d k0 d k0 d k1 d 00 d 00 ffffh 16-bit counter 0000h tq0ce bit external trigger input (tiq00 pin input) tq0ccr0 register inttq0cc0 signal toq00 pin output (only when software trigger is used) tq0ccrk register inttq0cck signal toq0k pin output delay (d k0 ) active level width (d 00 ? d k0 + 1) active level width (d 01 ? d k1 + 1) active level width (d 01 ? d k1 + 1) delay (d k1 ) delay (10000h + d k1 ) when the tq0ccr0 register is rewritten from d 00 to d 01 and the tq0ccrk register from d k0 to d k1 where d 00 > d 01 and d k0 > d k1 , if the tq0ccrk register is rewritten when the count value of the 16-bit counter is greater than d k1 and less than d k0 and if the tq0ccr0 register is rewritten when the count value is greater than d 01 and less than d 00 , each set value is reflected as soon as the register has been rewritten and compared with the count value. the counter co unts up to ffffh and then counts up again from 0000h. when the count value matches d k1 , the counter generates the inttq0cck signal and asserts the toq0k pin. when the count value matches d 01 , the counter generates the inttq0cc0 signal, deasserts the toq0k pin, and stops counting. therefore, the counter may output a pulse with a delay period or ac tive period different from that of the one-shot pulse that is originally expected. remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 373 (b) generation timing of compare match interrupt request signal (inttq0cck) the generation timing of the inttq0cck signal in the one-shot pulse out put mode is different from other inttq0cck signals; the inttq0cck signal is generat ed when the count value of the 16-bit counter matches the value of the tq0ccrk register. count clock 16-bit counter tq0ccrk register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 usually, the inttq0cck signal is generated when the 16- bit counter counts up next time after its count value matches the value of the tq0ccrk register. in the one-shot pulse output mode, howe ver, it is generated one clock earlier. this is because the timing is changed to match the change timing of the toq0k pin. remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 374 8.5.5 pwm output mode (tq0md 2 to tq0md0 bits = 100) in the pwm output mode, a pwm waveform is output fr om the toq01 to toq03 pi ns when the tq0ctl0.tq0ce bit is set to 1. in addition, a pulse with one cycle of the pwm waveform as half its cycle is output from the toq00 pin. figure 8-24. configuration in pwm output mode ccr0 buffer register tq0ce bit tq0ccr0 register clear match signal inttq0cc0 signal toq03 pin inttq0cc3 signal toq00 pin transfer s r tq0ccr1 register ccr1 buffer register match signal toq01 pin inttq0cc1 signal transfer transfer s r tq0ccr3 register ccr3 buffer register match signal transfer toq02 pin inttq0cc2 signal s r tq0ccr2 register ccr2 buffer register match signal 16-bit counter count clock selection count start control output controller (rs-ff) output controller output controller (rs-ff) output controller (rs-ff)
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 375 figure 8-25. basic timing in pwm output mode d 0 d 1 d 2 d 3 d 1 d 2 d 3 d 0 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 d 0 d 1 d 2 d 3 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output active level width (d 3 ) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) cycle (d 0 + 1) active level width (d 3 ) active level width (d 3 ) active level width (d 3 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 1 ) active level width (d 2 ) active level width (d 2 ) active level width (d 2 ) active level width (d 2 )
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 376 when the tq0ce bit is set to 1, the 16-bit counter is cleared from ffffh to 0000h, starts counting, and outputs pwm waveform from the toq0k pin. the active level width, cycle, and duty factor of the pwm waveform can be calculated as follows. active level width = (set value of tq0ccrk register ) count clock cycle cycle = (set value of tq0ccr0 register + 1) count clock cycle duty factor = (set value of tq0ccrk regist er)/(set value of tq0ccr0 register + 1) the pwm waveform can be changed by rewriting the tq0ccrm register while the counter is operating. the newly written value is reflected when the count value of the 16-bit counter matches the value of the ccr0 buffer register and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttq0cc0 is generated when the 16-bit counter counts next time after its count value matches the value of the ccr0 buffer register, and the 16-bit counter is cleared to 0000h. the compare match interrupt request signal inttq0cck is ge nerated when the count value of the 16-bit counter matches the value of the ccrk buffer register. remark k = 1 to 3, m = 0 to 3 figure 8-26. setting of registers in pwm output mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 0 0 tq0ctl1 100 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 0, 0: pwm output mode 0: operate on count clock selected by tq0cks0 to tq0cks2 bits 1: count external event input signal note the setting is invalid when the tq0ctl1.tq0eee bit = 1.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 377 figure 8-26. setting of registers in pwm output mode (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) toq0k pin output 16-bit counter ? when tq0olk bit = 0 toq0k pin output 16-bit counter ? when tq0olk bit = 1 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output setting of output level while operation of toq00 pin is disabled 0: low level 1: high level 0: disable toq01 pin output 1: enable toq01 pin output specification of active level of toq01 pin output 0: active-high 1: active-low 0/1 0/1 0/1 note tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 specification of active level of toq03 pin output 0: active-high 1: active-low 0: disable toq02 pin output 1: enable toq02 pin output specification of active level of toq02 pin output 0: active-high 1: active-low 0: disable toq03 pin output 1: enable toq03 pin output (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input. 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (e) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. note clear this bit to 0 when the toq00 pin is not used in the pwm output mode.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 378 figure 8-26. register setting in pwm output mode (3/3) (f) tmq0 capture/compare register s 0 to 3 (tq0ccr0 to tq0ccr3) if d 0 is set to the tq0ccr0 register and d k to the tq0ccr1 register, the cycle and active level of the pwm waveform are as follows. cycle = (d 0 + 1) count clock cycle active level width = d k count clock cycle remarks 1. tmq0 i/o control register 1 (tq0ioc1) and tmq0 option register 0 (tq0opt0) are not used in the pwm output mode. 2. updating the tmq0 capture/ compare register 2 (tq0ccr2) and tmq0 capture/compare register 3 (tq0ccr3) is validated by writ ing the tmq0 capture/compare register 1 (tq0ccr1).
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 379 (1) operation flow in pwm output mode figure 8-27. software processing flow in pwm output mode (1/2) d 10 d 10 d 10 d 20 d 30 d 00 d 11 d 21 d 01 d 31 d 11 d 21 d 00 d 31 d 20 d 30 d 00 d 21 d 00 d 31 d 11 d 21 d 00 d 31 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register ccr0 buffer register inttq0cc0 signal toq00 pin output tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output d 00 d 01 d 00 d 00 d 01 d 00 d 10 d 11 d 10 d 10 d 11 d 10 d 11 d 10 d 11 d 11 d 20 d 21 d 20 d 21 d 20 d 21 d 21 d 30 d 31 d 30 d 31 d 30 d 31 d 30 d 31 <1> <2> <3> <4> <5> <6> <7> d 11 d 10 d 20
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 380 figure 8-27. software processing flow in pwm output mode (2/2) start <1> count operation start flow tq0ce bit = 1 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed after writing the tq0ccr2 and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. tq0ccr1 register writing of the same value is necessary only when the set duty factor of toq02 and toq03 pin outputs is changed. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. only writing of the tq0ccr1 register must be performed when the set duty factor is only changed. when counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. counting is stopped. the tq0cks0 to tq0cks2 bits can be set at the same time when counting is enabled (tq0ce bit = 1). writing of the tq0ccr1 register must be performed after writing the tq0ccr0, tq0ccr2, and tq0ccr3 registers. when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer registers. tq0ccr1 writing of the same value is necessary only when the set cycle is changed. <2> tq0ccr0 to tq0ccr3 register setting change flow <3> tq0ccr0 register setting change flow <4> tq0ccr1 to tq0ccr3 register setting change flow <5> tq0ccr2, tq0ccr3 register setting change flow <6> tq0ccr1 register setting change flow <7> count operation stop flow tq0ce bit = 0 setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register setting of tq0ccr2, tq0ccr3 registers setting of tq0ccr1 register stop setting of tq0ccr1 register setting of tq0ccr0 register setting of tq0ccr1 register setting of tq0ccr0, tq0ccr2, and tq0ccr3 registers tq0ccr1 register when the counter is cleared after setting, the value of the tq0ccrm register is transferred to the ccrm buffer register. remark k = 1 to 3 m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 381 (2) pwm output mode operation timing (a) changing pulse width during operation to change the pwm waveform while the counter is operating, write the tq0ccr1 register last. rewrite the tq0ccrk register after writing the tq0ccr1 register after the inttq0cc1 signal is detected. ffffh 16-bit counter 0000h tq0ce bit d 30 d 00 d 01 d 30 d 30 d 20 d 20 d 20 d 21 d 11 d 00 d 00 d 31 d 01 d 01 d 21 d 11 d 31 tq0ccr0 register ccr0 buffer register inttq0cc0 signal tq0ccr1 register ccr1 buffer register inttq0cc1 signal toq01 pin output tq0ccr2 register ccr2 buffer register inttq0cc2 signal toq02 pin output tq0ccr3 register ccr3 buffer register inttq0cc3 signal toq03 pin output toq00 pin output d 10 d 10 d 10 d 00 d 11 d 10 d 11 d 10 d 21 d 20 d 21 d 20 d 31 d 30 d 31 d 30 d 00 d 01
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 382 to transfer data from the tq0ccrm register to the ccr m buffer register, the tq0ccr1 register must be written. to change both the cycle and active level of the pwm waveform at this time, first set the cycle to the tq0ccr0 register, set the active level width to t he tq0ccr2 and tq0ccr3 registers, and then set an active level width to the tq0ccr1 register. to change only the active level width (duty factor) of pwm wave, first set the active level to the tq0ccr2 and tq0ccr3 registers, and then set an active level to the tq0ccr1 register. to change only the active level width (duty factor) of the pwm waveform output by the toq01 pin, only the tq0ccr1 register has to be set. to change only the active level width (duty factor) of the pwm waveform output by the toq02 and toq03 pins, first set an active level width to the tq0 ccr2 and tq0ccr3 registers, and then write the same value to the tq0ccr1 register. after the tq0ccr1 register is written, the value wr itten to the tq0ccrm register is transferred to the ccrm buffer register in synchronization with the timi ng of clearing the 16-bit counter, and is used as a value to be compared with the value of the 16-bit counter. to change only the cycle of the pwm waveform, first set a cycle to the tq0ccr0 register, and then write the same value to the tq0ccr1 register. to write the tq0ccr0 to tq0ccr3 registers again afte r writing the tq0ccr1 register once, do so after the inttq0cc0 signal is generated. otherwise, t he value of the ccrm buffer register may become undefined because the timing of transferring data from the tq0ccrm register to the ccrm buffer register conflicts with writing the tq0ccrm register. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 383 (b) 0%/100% output of pwm waveform to output a 0% waveform, set the tq0ccrk register to 0000h. if the set value of the tq0ccr0 register is ffffh, the inttq0cck signal is generated periodically. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 0000h d 0 0000h d 0 0000h d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark k = 1 to 3 to output a 100% waveform, set a value of (set value of tq0ccr0 register + 1) to the tq0ccrk register. if the set value of the tq0ccr0 register is ffffh, 100% output cannot be produced. count clock 16-bit counter tq0ce bit tq0ccr0 register tq0ccrk register inttq0cc0 signal inttq0cck signal toq0k pin output d 0 d 0 + 1 d 0 d 0 + 1 d 0 d 0 + 1 d 0 ? 1d 0 0000 ffff 0000 d 0 ? 1d 0 0000 0001 remark k = 1 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 384 (c) generation timing of compare match interrupt request signal (inttq0cck) the timing of generation of the inttq0cck signal in the pwm output mode differs from the timing of other inttq0cck signals; the inttq0cck signal is generat ed when the count value of the 16-bit counter matches the value of the tq0ccrk register. count clock 16-bit counter ccrk buffer register toq0k pin output inttq0cck signal d k d k ? 2d k ? 1d k d k + 1 d k + 2 remark k = 1 to 3 usually, the inttq0cck signal is generated in synch ronization with the next counting up after the count value of the 16-bit counter matches the value of the tq0ccrk register. in the pwm output mode, however, it is generated one clock earlier. this is because the timing is changed to match the change timing of the output signal of the toq0k pin.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 385 8.5.6 free-running timer mode (t q0md2 to tq0md0 bits = 101) in the free-running timer mode, 16-bit timer/event counter q starts counting when the tq0ctl0.tq0ce bit is set to 1. at this time, the tq0ccrm register can be used as a compare register or a captur e register, depending on the setting of the tq0opt0.tq0ccs 0 and tq0opt0.tq0ccs1 bits. remark m = 0 to 3 figure 8-28. configuration in free-running timer mode toq03 pin output toq02 pin output toq01 pin output toq00 pin output inttq0ov signal tq0ccs0, tq0ccs1 bits (capture/compare selection) inttq0cc3 signal inttq0cc2 signal inttq0cc1 signal inttq0cc0 signal tiq03 pin (capture trigger input) tq0ccr3 register (capture) tiq00pin (external event count input/ capture trigger input) internal count clock tq0ce bit tiq01 pin (capture trigger input) tiq02 pin (capture trigger input) tq0ccr0 register (capture) tq0ccr1 register (capture) tq0ccr2 register (capture) tq0ccr3 register (compare) tq0ccr2 register (compare) tq0ccr1 register (compare) 0 1 0 1 0 1 0 1 16-bit counter tq0ccr0 register (compare) output controller output controller output controller output controller count clock selection edge detector edge detector edge detector edge detector edge detector
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 386 when the tq0ce bit is set to 1, 16-bit timer/event counter q starts counting, and the ou tput signals of the toq00 to toq03 pins are inverted. when the count value of the 16-bit counter later matches the set value of the tq0ccrm register, a compare match interrupt request signal (inttq 0ccm) is generated, and the output signal of the toq0m pin is inverted. the 16-bit counter continues counting in synchronization with t he count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttq0ov) at the next clock, is cl eared to 0000h, and continues counting. at this time, the overflow flag (tq0opt0.tq0ovf bi t) is also set to 1. clear the overflow flag to 0 by executing the clr instruction by software. the tq0ccrm register can be rewritten while the counter is ope rating. if it is rewritten, the new value is reflected at that time, and compared with the count value. figure 8-29. basic timing in free-r unning timer mode (compare function) d 10 d 20 d 30 d 00 d 20 d 31 d 31 d 30 d 00 d 11 d 11 d 21 d 01 d 11 d 21 d 01 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output inttq0ov signal tq0ovf bit toq00 pin output tq0ccr1 register inttq0cc1 signal tq0ce bit tq0ccr0 register inttq0cc0 signal d 00 d 01 d 11 d 10 d 21 d 20 d 31 d 30
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 387 when the tq0ce bit is set to 1, the 16-bit counter starts c ounting. when the valid edge input to the tiq0m pin is detected, the count val ue of the 16-bit counter is stored in the tq0 ccrm register, and a capture interrupt request signal (inttq0ccm) is generated. the 16-bit counter continues counting in synchronization with t he count clock. when it counts up to ffffh, it generates an overflow interrupt request signal (inttq0ov) at the next clock, is cl eared to 0000h, and continues counting. at this time, the overflow flag (tq0ovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction by software. figure 8-30. basic timing in free-r unning timer mode (capture function) d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 22 d 32 d 03 d 13 d 33 d 23 0000 d 00 d 01 d 02 d 03 0000 d 10 d 11 d 12 d 13 0000 d 20 d 21 d 23 d 22 0000 d 30 d 31 d 32 d 33 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 388 figure 8-31. register setting in free-running timer mode (1/3) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce note the setting is invalid when the tq0ctl1.tq0eee bit = 1 (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 0 0 tq0ctl1 101 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 0, 1: free-running mode 0: operate with count clock selected by tq0cks0 to tq0cks2 bits 1: count on external event count input signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 389 figure 8-31. register setting in free-running timer mode (2/3) (c) tmq0 i/o control register 0 (tq0ioc0) 0/1 0/1 0/1 0/1 0/1 tq0ioc0 0: disable toq00 pin output 1: enable toq00 pin output 0: disable toq01 pin output 1: enable toq01 pin output setting of output level with operation of toq01 pin disabled 0: low level 1: high level 0/1 0/1 0/1 tq0oe1 tq0ol0 tq0oe0 tq0ol1 tq0oe3 tq0ol2 tq0oe2 tq0ol3 setting of output level with operation of toq03 pin disabled 0: low level 1: high level 0: disable toq02 pin output 1: enable toq02 pin output setting of output level with operation of toq02 pin disabled 0: low level 1: high level 0: disable toq03 pin output 1: enable toq03 pin output setting of output level with operation of toq00 pin disabled 0: low level 1: high level (d) tmq0 i/o control register 1 (tq0ioc1) 0/1 0/1 0/1 0/1 0/1 tq0ioc1 select valid edge of tiq00 pin input select valid edge of tiq01 pin input 0/1 0/1 0/1 tq0is2 tq0is1 tq0is0 tq0is3 tq0is6 tq0is5 tq0is4 tq0is7 select valid edge of tiq02 pin input select valid edge of tiq03 pin input
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 390 figure 8-31. register setting in free-running timer mode (3/3) (e) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1 (f) tmq0 option register 0 (tq0opt0) 0/1 0/1 0/1 0/1 0 tq0opt0 overflow flag specifies if tq0ccr0 register functions as capture or compare register specifies if tq0ccr1 register functions as capture or compare register 0 0 0/1 tq0ccs0 tq0ovf tq0ccs1 tq0ccs2 tq0ccs3 specifies if tq0ccr2 register functions as capture or compare register specifies if tq0ccr3 register functions as capture or compare register (g) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (h) tmq0 capture/compare regist ers 0 to 3 (tq0ccr0 to tq0ccr3) these registers function as captur e registers or compare registers depending on the setting of the tq0opt0.tq0ccsm bit. when the registers function as captur e registers, they store the count value of the 16-bit counter when the valid edge input to the tiq0m pin is detected. when the registers function as compare registers and when d m is set to the tq0ccrm register, the inttq0ccm signal is generated when the counter reaches (d m + 1), and the output signal of the toq0m pin is inverted. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 391 (1) operation flow in free-running timer mode (a) when using capture/compare register as compare register figure 8-32. software processing flow in fr ee-running timer mode (c ompare function) (1/2) d 10 d 20 d 30 d 00 d 10 d 20 d 30 d 00 d 11 d 31 d 01 d 21 d 21 d 11 d 11 d 31 d 01 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output inttq0ov signal tq0ovf bit d 00 d 10 d 20 d 30 d 01 d 11 d 21 d 31 cleared to 0 by clr instruction set value changed set value changed set value changed set value changed cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> <2>
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 392 figure 8-32. software processing flow in fr ee-running timer mode (c ompare function) (2/2) tq0ce bit = 1 read tq0opt0 register (check overflow flag). register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc0 register, tq0ioc2 register, tq0opt0 register, tq0ccr0 to tq0ccr3 registers initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). start execute instruction to clear tq0ovf bit (clr tq0ovf). <1> count operation start flow <2> overflow flag clear flow tq0ce bit = 0 counter is initialized and counting is stopped by clearing tq0ce bit to 0. stop <3> count operation stop flow tq0ovf bit = 1 no yes
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 393 (b) when using capture/compare register as capture register figure 8-33. software processing flow in fr ee-running timer mode (c apture function) (1/2) d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 22 d 32 d 03 d 13 d 33 d 23 0000 d 00 d 01 d 02 d 03 0000 0000 0000 0000 0000 d 10 d 11 d 12 d 13 0000 d 20 d 21 d 23 d 22 0000 d 30 d 31 d 32 d 33 cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction <3> <1> <2> <2> <2> ffffh 16-bit counter 0000h tq0ce bit tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal tiq00 pin input tq0ccr0 register inttq0cc0 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 394 figure 8-33. software processing flow in fr ee-running timer mode (c apture function) (2/2) tq0ce bit = 1 read tq0opt0 register (check overflow flag). register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits) tq0ctl1 register, tq0ioc1 register, tq0opt0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). start execute instruction to clear tq0ovf bit (clr tq0ovf). <1> count operation start flow <2> overflow flag clear flow tq0ce bit = 0 counter is initialized and counting is stopped by clearing tq0ce bit to 0. stop <3> count operation stop flow tq0ovf bit = 1 no yes
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 395 (2) operation timing in free-running timer mode (a) interval operation with compare register when 16-bit timer/event counter q is used as an in terval timer with the tq0ccrm register used as a compare register, software processing is necessary for setting a comparison value to generate the next interrupt request signal each time t he inttq0ccm signal has been detected. d 00 d 10 d 20 d 01 d 30 d 12 d 03 d 22 d 31 d 21 d 23 d 02 d 13 ffffh 16-bit counter 0000h tq0ce bit tq0ccr0 register inttq0cc0 signal toq00 pin output tq0ccr1 register inttq0cc1 signal toq01 pin output tq0ccr2 register inttq0cc2 signal toq02 pin output tq0ccr3 register inttq0cc3 signal toq03 pin output interval period (d 00 + 1) interval period (10000h + d 02 ? d 01 ) interval period (d 01 ? d 00 ) interval period (d 03 ? d 02 ) interval period (d 04 ? d 03 ) d 00 d 01 d 02 d 03 d 04 d 05 interval period (d 10 + 1) interval period (10000h + d 12 ? d 11 ) interval period (d 11 ? d 10 ) interval period (d 13 ? d 12 ) d 10 d 11 d 12 d 13 d 14 interval period (d 20 + 1) interval period (10000h + d 21 ? d 20 ) interval period (10000h + d 23 ? d 22 ) interval period (d 22 ? d 21 ) interval period (d 30 + 1) interval period (10000h + d 31 ? d 30) d 20 d 21 d 22 d 23 d 31 d 30 d 32 d 04 d 11
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 396 when performing an interval operation in the free-running timer mode, two intervals can be set with one channel. to perform the interval operation, the value of the co rresponding tq0ccrm register must be re-set in the interrupt servicing that is executed when the inttq0ccm signal is detected. the set value for re-setting the tq0ccrm register c an be calculated by the following expression, where "d m " is the interval period. compare register default value: d m ? 1 value set to compare register second and subsequent time: previous set value + d m (if the calculation result is greate r than ffffh, subtract 10000h from the result and set this value to the register.) remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 397 (b) pulse width measurement with capture register when pulse width measurement is performed with the tq0ccrm register used as a capture register, software processing is necessary for reading the capt ure register each time the inttq0ccm signal has been detected and for calculating an interval. d 20 d 00 d 30 d 10 d 11 d 21 d 31 d 12 d 01 d 02 d 32 d 13 d 03 d 22 d 33 d 23 0000 pulse interval (10000h + d 01 ? d 00 ) pulse interval (10000h + d 02 ? d 01 ) pulse interval (10000h + d 03 ? d 02 ) d 00 d 01 d 02 d 03 pulse interval (d 00 + 1) 0000 pulse interval (10000h + d 11 ? d 10 ) pulse interval (10000h + d 12 ? d 11 ) pulse interval (d 13 ? d 12 ) d 10 d 11 d 12 d 13 pulse interval (d 10 + 1) 0000 pulse interval (10000h + d 21 ? d 20 ) pulse interval (20000h + d 22 ? d 21 ) pulse interval (d 23 ? d 22 ) d 20 d 21 d 23 d 22 pulse interval (d 20 + 1) 0000 pulse interval (10000h + d 31 ? d 30 ) pulse interval (10000h + d 32 ? d 31 ) pulse interval (10000h + d 33 ? d 32 ) d 30 d 31 d 32 d 33 pulse interval (d 30 + 1) cleared to 0 by clr instruction cleared to 0 by clr instruction cleared to 0 by clr instruction ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal tiq02 pin input tq0ccr2 register inttq0cc2 signal tiq03 pin input tq0ccr3 register inttq0cc3 signal inttq0ov signal tq0ovf bit tiq01 pin input tq0ccr1 register inttq0cc1 signal
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 398 when executing pulse width measurement in the fr ee-running timer mode, four pulse widths can be measured with one channel. to measure a pulse width, the pu lse width can be calculated by re ading the value of the tq0ccrm register in synchronization with the inttq0ccm si gnal, and calculatin g the difference between the read value and the previously read value. remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 399 (c) processing of overflow when two or more capture registers are used care must be exercised in processing the overflow flag when two capture registers are used. first, an example of incorrect processing is shown below. example of incorrect processing when tw o or more capture registers are used ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register tiq01 pin input tq0ccr1 register inttq0ov signal tq0ovf bit d 00 d 01 d 10 d 11 d 10 <1> <2> <3> <4> d 00 d 11 d 01 the following problem may occur when two pulse widt hs are measured in the free-running timer mode. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> read the tq0ccr0 register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <4> read the tq0ccr1 register. read the overflow flag. because the flag is cleared in <3>, 0 is read. because the overflow flag is 0, the pulse width can be calculated by (d 11 ? d 10 ) (incorrect). when two capture registers are used, and if the overflow flag is cleared to 0 by one capture register, the other capture register may not obtain the correct pulse width. use software when using two capture registers. an example of how to use software is shown below.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 400 (1/2) example when two capture registers are used (usi ng overflow interrupt) ffffh 16-bit counter 0000h tq0ce bit inttq0ov signal tq0ovf bit tq0ovf0 flag note tiq00 pin input tq0ccr0 register tq0ovf1 flag note tiq01 pin input tq0ccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tq0ovf0 and tq0ovf1 flags are set on the internal ram by software. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> an overflow occurs. set the tq0ovf0 and tq0ovf1 flags to 1 in the overflow interrupt servicing, and clear the overflow flag to 0. <4> read the tq0ccr0 register. read the tq0ovf0 flag. if the tq0o vf0 flag is 1, clear it to 0. because the tq0ovf0 flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tq0ccr1 register. read the tq0ovf1 flag. if the tq0ovf1 flag is 1, clear it to 0 (the tq0ovf0 flag is cleared in <4>, and the tq0ovf1 flag remains 1). because the tq0ovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 401 (2/2) example when two capture re gisters are used (without using overflow interrupt) ffffh 16-bit counter 0000h tq0ce bit inttq0ov signal tq0ovf bit tq0ovf0 flag note tiq00 pin input tq0ccr0 register tq0ovf1 flag note tiq01 pin input tq0ccr1 register d 10 d 11 d 00 d 01 d 10 <1> <2> <5> <6> <3> <4> d 00 d 11 d 01 note the tq0ovf0 and tq0ovf1 flags are set on the internal ram by software. <1> read the tq0ccr0 register (setting of t he default value of t he tiq00 pin input). <2> read the tq0ccr1 register (setting of t he default value of t he tiq01 pin input). <3> an overflow occurs. nothing is done by software. <4> read the tq0ccr0 register. read the overflow flag. if the overflow flag is 1, set only the tq0ovf1 flag to 1, and clear the overflow flag to 0. because the overflow flag is 1, the pulse width can be calculated by (10000h + d 01 ? d 00 ). <5> read the tq0ccr1 register. read the overflow flag. because the overflow flag is cleared in <4>, 0 is read. read the tq0ovf1 flag. if the tq0o vf1 flag is 1, clear it to 0. because the tq0ovf1 flag is 1, the pulse width can be calculated by (10000h + d 11 ? d 10 ) (correct). <6> same as <3>
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 402 (d) processing of overflow if capture trigger interval is long if the pulse width is greater than one cycle of the 16- bit counter, care must be exercised because an overflow may occur more than once from the first captur e trigger to the next. first, an example of incorrect processing is shown below. example of incorrect processing when capture trigger interval is long ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ov signal tq0ovf bit d m0 d m1 d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width the following problem may occur when a long pulse width in the free-running timer mode. <1> read the tq0ccrm register (setting of t he default value of the tiq0m pin input). <2> an overflow occurs. nothing is done by software. <3> an overflow occurs a second time. nothing is done by software. <4> read the tq0ccrm register. read the overflow flag. if the overflow flag is 1, clear it to 0. because the overflow flag is 1, the pul se width can be calculated by (10000h + d m1 ? d m0 ) (incorrect). actually, the pulse width must be (20000h + d m1 ? d m0 ) because an overflow occurs twice. if an overflow occurs twice or more when the capture tr igger interval is long, the correct pulse width may not be obtained. if the capture trigger interval is long, slow the count clock to lengthen one cycle of the 16-bit counter, or use software. an example of how to use software is shown next.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 403 example when capture trigger interval is long ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ov signal tq0ovf bit overflow counter note d m0 d m1 1h 0h 2h 0h d m0 d m1 <1> <2> <3> <4> 1 cycle of 16-bit counter pulse width note the overflow counter is set arbitrarily by software on the internal ram. <1> read the tq0ccrm register (setting of t he default value of the tiq0m pin input). <2> an overflow occurs. increment the overflow count er and clear the overflow flag to 0 in the overflow interrupt servicing. <3> an overflow occurs a second time. increment (+1) the overflow counter and clear the overflow flag to 0 in the overflow interrupt servicing. <4> read the tq0ccrm register. read the overflow counter. when the overflow counter is "n", t he pulse width can be calculated by (n 10000h + d m1 ? d m0 ). in this example, the pulse width is (20000h + d m1 ? d m0 ) because an overflow occurs twice. clear the overflow counter (0h).
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 404 (e) clearing overflow flag the overflow flag can be cleared to 0 by clearing the tq0ovf bit to 0 with the clr instruction and by writing 8-bit data (bit 0 is 0) to the tq0opt0 register. to accurate ly detect an overflow, read the tq0ovf bit when it is 1, and then clear the overflow flag by using a bit manipulation instruction. (i) operation to write 0 (without conflict with setting) (iii) operation to clear to 0 (without conflict with setting) (ii) operation to write 0 (conflict with setting) (iv) operation to clear to 0 (conflict with setting) 0 write signal overflow set signal register access signal overflow flag (tq0ovf bit) read write 0 write signal overflow set signal register access signal overflow flag (tq0ovf bit) read write 0 write signal overflow set signal 0 write signal overflow set signal overflow flag (tq0ovf bit) overflow flag (tq0ovf bit) l h l to clear the overflow flag to 0, read the overflow flag to check if it is set to 1, and clear it with the clr instruction. if 0 is written to the overflow flag wit hout checking if the flag is 1, the set information of overflow may be erased by writing 0 ((ii) in the above chart). therefore, software may judge that no overflow has occurred even when an overflow actually has occurred. if execution of the clr instruction conflicts with occurrence of an over flow when the overflow flag is cleared to 0 with the clr instruction, the overflow flag remains set even after execution of the clear instruction.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 405 8.5.7 pulse width measurement mode (tq0md2 to tq0md0 bits = 110) in the pulse width measurement mode, 16-bit timer/even t counter q starts counting when the tq0ctl0.tq0ce bit is set to 1. each time the valid edge input to the tiq0m pi n has been detected, t he count value of t he 16-bit counter is stored in the tq0ccrm register, and the 16-bit counter is cleared to 0000h. the interval of the valid edge can be measured by reading the tq0ccrm register after a capture interrupt request signal (inttq0ccm) occurs. select either of the tiq00 to tiq03 pins as the capture tr igger input pin. specify "no edge detected" by using the tq0ioc1 register for the unused pins. when an external clock is used as the count clock, measur e the pulse width of the tiq0k pin because the external clock is fixed to the tiq00 pin. at this time, clear the tq0ioc1.tq0is1 and tq0ioc1. tq0is0 bits to 00 (capture trigger input (tiq00 pin): no edge detected). remark m = 0 to 3 k = 1 to 3 figure 8-34. configuration in pulse width measurement mode inttq0ov signal inttq0cc0 signal inttq0cc1 signal inttq0cc2 signal inttq0cc3 signal tiq03 pin (capture trigger input) tq0ccr3 register (capture) tiq00 pin (external event count input/capture trigger input) internal count clock tq0ce bit tiq01 pin (capture trigger input) tiq02 pin (capture trigger input) tq0ccr0 register (capture) tq0ccr1 register (capture) tq0ccr2 register (capture) 16-bit counter clear edge detector edge detector edge detector edge detector edge detector count clock selection
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 406 figure 8-35. basic timing in pulse width measurement mode ffffh 16-bit counter 0000h tq0ce bit tiq0m pin input tq0ccrm register inttq0ccm signal inttq0ov signal tq0ovf bit d 0 0000h d 1 d 2 d 3 cleared to 0 by clr instruction remark m = 0 to 3 when the tq0ce bit is set to 1, the 16-bit counter starts c ounting. when the valid edge input to the tiq0m pin is later detected, the count value of the 16-bit counter is stored in the tq0ccrm register, the 16-bit counter is cleared to 0000h, and a capture interrupt request signal (inttq0ccm) is generated. the pulse width is calculated as follows. pulse width = captured value count clock cycle if the valid edge is not input to the tiq0m pin even when the 16-bit counter coun ted up to ffffh, an overflow interrupt request signal (inttq0ov) is generated at the next c ount clock, and the counter is cleared to 0000h and continues counting. at this time, the overflow flag (tq0opt0.t q0ovf bit) is also set to 1. clear the overflow flag to 0 by executing the clr instruction via software. if the overflow flag is set to 1, the pu lse width can be calculated as follows. pulse width = (10000h tq0ovf bit set (1) count + captured value) count clock cycle remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 407 figure 8-36. register setting in pu lse width measurement mode (1/2) (a) tmq0 control register 0 (tq0ctl0) 0/1 0 0 0 0 tq0ctl0 select count clock note 0: stop counting 1: enable counting 0/1 0/1 0/1 tq0cks2 tq0cks1 tq0cks0 tq0ce note setting is invalid when the tq0eee bit = 1. (b) tmq0 control register 1 (tq0ctl1) 0 0 0/1 0 0 tq0ctl1 110 tq0md2 tq0md1 tq0md0 tq0eee tq0est 1, 1, 0: pulse width measurement mode 0: operate with count clock selected by tq0cks0 to tq0cks2 bits 1: count external event count input signal (c) tmq0 i/o control register 1 (tq0ioc1) 0/1 0/1 0/1 0/1 0/1 tq0ioc1 select valid edge of tiq00 pin input select valid edge of tiq01 pin input 0/1 0/1 0/1 tq0is2 tq0is1 tq0is0 tq0is3 tq0is6 tq0is5 tq0is4 tq0is7 select valid edge of tiq02 pin input select valid edge of tiq03 pin input (d) tmq0 i/o control register 2 (tq0ioc2) 0 0 0 0 0/1 tq0ioc2 select valid edge of external event count input 0/1 0 0 tq0ees0 tq0ets1 tq0ets0 tq0ees1
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 408 figure 8-36. register setting in pu lse width measurement mode (2/2) (e) tmq0 option register 0 (tq0opt0) 00000 tq0opt0 overflow flag 0 0 0/1 tq0ccs0 tq0ovf tq0ccs1 tq0ccs2 tq0ccs3 (f) tmq0 counter read buffer register (tq0cnt) the value of the 16-bit counter can be read by reading the tq0cnt register. (g) tmq0 capture/compare regist ers 0 to 3 (tq0ccr0 to tq0ccr3) these registers store the count va lue of the 16-bit counter when the valid edge input to the tiq0m pin is detected. remarks 1. tmq0 i/o control register 0 (tq0ioc0) is not used in the pulse width measurement mode. 2. m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 409 (1) operation flow in pul se width measurement mode figure 8-37. software processing flow in pulse width measurement mode <1> <2> set tq0ctl0 register (tq0ce bit = 1) tq0ce bit = 0 register initial setting tq0ctl0 register (tq0cks0 to tq0cks2 bits), tq0ctl1 register, tq0ioc1 register, tq0ioc2 register, tq0opt0 register initial setting of these registers is performed before setting the tq0ce bit to 1. the tq0cks0 to tq0cks2 bits can be set at the same time when counting has been started (tq0ce bit = 1). the counter is initialized and counting is stopped by clearing the tq0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow ffffh 16-bit counter 0000h tq0ce bit tiq00 pin input tq0ccr0 register inttq0cc0 signal d 0 0000h 0000h d 1 d 2
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 410 (2) operation timing in pul se width measurement mode (a) clearing overflow flag the overflow flag can be cleared to 0 by clearing the tq0ovf bit to 0 with the clr instruction and by writing 8-bit data (bit 0 is 0) to the tq0opt0 register. to accurate ly detect an overflow, read the tq0ovf bit when it is 1, and then clear the overflow flag by using a bit manipulation instruction. (i) operation to write 0 (without conflict with setting) (iii) operation to clear to 0 (without conflict with setting) (ii) operation to write 0 (conflict with setting) (iv) operation to clear to 0 (conflict with setting) 0 write signal overflow set signal register access signal overflow flag (tq0ovf bit) read write 0 write signal overflow set signal register access signal overflow flag (tq0ovf bit) read write 0 write signal overflow set signal 0 write signal overflow set signal overflow flag (tq0ovf bit) overflow flag (tq0ovf bit) l h l to clear the overflow flag to 0, read the overflow flag to check if it is set to 1, and clear it with the clr instruction. if 0 is written to the overflow flag wit hout checking if the flag is 1, the set information of overflow may be erased by writing 0 ((ii) in the above chart). therefore, software may judge that no overflow has occurred even when an overflow actually has occurred. if execution of the clr instruction conflicts with occurrence of an over flow when the overflow flag is cleared to 0 with the clr instruction, the overflow flag remains set even after execution of the clear instruction.
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 411 8.5.8 timer output operations the following table shows the operations and out put levels of the toq00 to toq03 pins. table 8-6. timer output control in each mode operation mode toq00 pin toq 01 pin toq02 pin toq03 pin interval timer mode square wave output external event count mode square wave output ? external trigger pulse output mode external trigger pulse output external trigger pulse output external trigger pulse output one-shot pulse output mode one-shot pulse output one-shot pulse output one-shot pulse output pwm output mode square wave output pwm output pwm output pwm output free-running timer mode square wave output (only when compare function is used) pulse width measurement mode ? table 8-7. truth table of toq00 to toq03 pins under control of timer output control bits tq0ioc0.tq0olm bit tq0ioc0.tq0oem bit tq0ctl0.tq0ce bit level of toq0m pin 0 low-level output 0 low-level output 0 1 1 low level immediately before counting, high level after counting is started 0 high-level output 0 high-level output 1 1 1 high level immediately before counting, low level after counting is started remark m = 0 to 3
chapter 8 16-bit timer/event counter q (tmq) preliminary user's manual u17714ej1v0ud 412 8.6 cautions (1) capture operation when the capture operation is used and a slow clock is selected as the count clock, ffffh, not 0000h, may be captured in the tq0ccr0, tq0ccr1, tq0ccr2, and tq 0ccr3 registers if the capture trigger is input immediately after the tq0ce bit is set to 1. (a) free-running timer mode count clock 0000h ffffh tq0ce bit tq0ccr0 register ffffh 0001h 0000h tiq00 pin input capture trigger input 16-bit counter sampling clock (f xx ) capture trigger input (b) pulse width measurement mode 0000h ffffh ffffh 0002h 0000h count clock tq0ce bit tq0ccr0 register tiq00 pin input capture trigger input 16-bit counter sampling clock (f xx ) capture trigger input
preliminary user's manual u17714ej1v0ud 413 chapter 9 16-bit interval timer m (tmm) 9.1 overview ? interval function ? 8 clocks selectable ? 16-bit counter 1 (the 16-bit counter cannot be read during timer count operation.) ? compare register 1 (the compare register cannot be written during timer counter operation.) ? compare match interrupt 1 timer m supports only the clear & start mode. the free-running timer mode is not supported.
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 414 9.2 configuration tmm0 includes the following hardware. table 9-1. configuration of tmm0 item configuration timer register 16-bit counter register tmm0 compare register 0 (tm0cmp0) control register tmm0 control register 0 (tm0ctl0) figure 9-1. block diagram of tmm0 tm0ctl0 internal bus f xx f xx /2 f xx /4 f xx /64 f xx /512 intwt f r /8 f xt controller 16-bit counter match clear inttm0eq0 tm0cmp0 tm0ce tm0cks2 tm0cks1tm0cks0 selector remark f xx : main clock frequency f r : internal oscillation clock frequency f xt : subclock frequency intwt: watch timer interrupt request signal (1) 16-bit counter this is a 16-bit counter that counts the internal clock. the 16-bit counter cannot be read or written. (2) tmm0 compare register 0 (tm0cmp0) the tm0cmp0 register is a 16-bit compare register. this register can be read or written in 16-bit units. reset sets this register to 0000h. the same value can always be written to the tm0cmp0 register by software. tm0cmp0 register rewrite is prohibit ed when the tm0ctl0.tm0ce bit = 1. tm0cmp0 12108642 after reset: 0000h r/w address: fffff694h 14 0 13119753 15 1
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 415 9.3 register (1) tmm0 control register (tm0ctl0) the tm0ctl0 register is an 8-bit regist er that controls the tmm0 operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. the same value can always be written to the tm0ctl0 register by software. tm0ce tmm0 operation disabled (16-bit counter reset asynchronously). operation clock application stopped. tmm0 operation enabled. operation clock application started. tmm0 operation started. tm0ce 0 1 internal clock operation enable/disable specification tm0ctl0 0 0 0 0 tm0cks2 tm0cks1 tm0cks0 654321 after reset: 00h r/w address: fffff690h the internal clock control and internal circuit reset for tmm0 are performed asynchronously with the tm0ce bit. when the tm0ce bit is cleared to 0, the internal clock of tmm0 is disabled (fixed to low level) and 16-bit counter is reset asynchronously. <7> 0 f xx f xx /2 f xx /4 f xx /64 f xx /512 intwt f r /8 f xt tm0cks2 0 0 0 0 1 1 1 1 count clock selection tm0cks1 0 0 1 1 0 0 1 1 tm0cks0 0 1 0 1 0 1 0 1 cautions 1. set the tm0cks2 to tm 0cks0 bits when tm0ce bit = 0. when changing the value of tm0ce from 0 to 1, it is not possible to set the value of the tm0cks2 to tm0cks0 bits simultaneously. 2. be sure to clear bits 3 to 6 to ?0?. remark f xx : main clock frequency f r : internal oscillation clock frequency f xt : subclock frequency
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 416 9.4 operation caution do not set the tm0cmp0 register to ffffh. 9.4.1 interval timer mode in the interval timer mode, an interrupt request signal (i nttm0eq0) is generated at the specified interval if the tm0ctl0.tm0ce bit is set to 1. figure 9-2. configuration of interval timer 16-bit counter tm0cmp0 register tm0ce bit count clock selection clear match signal inttm0eq0 signal figure 9-3. basic timing of operation in interval timer mode ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal d d d d d interval (d + 1) interval (d + 1) interval (d + 1) interval (d + 1) when the tm0ce bit is set to 1, the value of the 16-bit counter is cleared from ffffh to 0000h in synchronization with the count clock, and the c ounter starts counting. when the count value of the 16-bit counter matches the value of the tm0cmp0 register, the 16-bit counter is cleared to 0000h and a compare match interrupt request signal (inttm0eq0) is generated. the interval can be calculated by the following expression. interval = (set value of tm0cmp0 register + 1) count clock cycle
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 417 figure 9-4. register setting for interval timer mode operation (a) tmm0 control register 0 (tm0ctl0) 0/1 0 0 0 0 tm0ctl0 0/1 0/1 0/1 tm0cks2 tm0cks1 tm0cks0 tm0ce 0: stop counting 1: enable counting select count clock (b) tmm0 compare register 0 (tm0cmp0) if the tm0cmp0 register is set to d, the interval is as follows. interval = (d + 1) count clock cycle
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 418 (1) interval timer mode operation flow figure 9-5. software processing flow in interval timer mode ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal d d d d <1> <2> tm0ce bit = 1 tm0ce bit = 0 register initial setting tm0ctl0 register (tm0cks0 to tm0cks2 bits) tm0cmp0 register initial setting of these registers is performed before setting the tm0ce bit to 1. the tm0cks0 to tm0cks2 bits can be set at the same time when counting has been started (tm0ce bit = 1). the counter is initialized and counting is stopped by clearing the tm0ce bit to 0. start stop <1> count operation start flow <2> count operation stop flow
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 419 (2) interval timer mode operation timing caution do not set the tm0cmp0 register to ffffh. (a) operation if tm0cmp0 register is set to 0000h if the tm0cmp0 register is set to 0000h, the inttm 0eq0 signal is generated at each count clock. the value of the 16-bit counter is always 0000h. count clock 16-bit counter tm0ce bit tm0cmp0 register inttm0eq0 signal 0000h interval time count clock cycle ffffh 0000h 0000h 0000h 0000h interval time count clock cycle (b) operation if tm0cmp0 register is set to n if the tm0cmp0 register is set to n, the 16-bit counter counts up to n. the counter is cleared to 0000h in synchronization with the next count-up timing and the inttm0eq0 signal is generated. ffffh 16-bit counter 0000h tm0ce bit tm0cmp0 register inttm0eq0 signal n interval time (n + 1) count clock cycle interval time (n + 1) count clock cycle interval time (n + 1) count clock cycle n remark 0000h < n < ffffh
chapter 9 16-bit interval timer m (tmm) preliminary user's manual u17714ej1v0ud 420 9.4.2 cautions (1) it takes the 16-bit counter up to the following time to start counting after the tm0ctl0.tm0ce bit is set to 1, depending on the count clock selected. selected count clock maximum time before counting start f xx 2/f xx f xx /2 6/f xx f xx /4 24/f xx f xx /64 128/f xx f xx /512 1024/f xx intwt second rising edge of intwt signal f r /8 16/f r f xt 2/f xt (2) rewriting the tm0cmp0 and tm0ctl0 regist ers is prohibited while tmm0 is operating. if these registers are rewritten while the tm0c e bit is 1, the operation cannot be guaranteed. if they are rewritten by mistake, clear the tm 0ctl0.tm0ce bit to 0, and re-set the registers.
preliminary user's manual u17714ej1v0ud 421 chapter 10 watch timer functions 10.1 functions the watch timer has the following functions. ? watch timer: an interrupt request signal (intwt) is gene rated at intervals of 0.5 or 0.25 seconds by using the main clock or subclock. ? interval timer: an interrupt request sig nal (intwti) is generated at set intervals. the watch timer and interval timer functions can be used at the same time.
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 422 10.2 configuration the block diagram of the watch timer is shown below. figure 10-1. block diagram of watch timer internal bus watch timer operation mode register (wtm) f brg f w /2 4 f w /2 5 f w /2 6 f w /2 7 f w /2 8 f w /2 10 f w /2 11 f w /2 9 f xt 11-bit prescaler clear clear intwt intwti wtm0 wtm1 wtm2 wtm3 wtm4 wtm5 wtm6 wtm7 5-bit counter f w 3 f x f x /8 f x /4 f x /2 f x bgcs00 bgcs01 bgce0 3-bit prescaler 8-bit counter clear match f bgcs prsm0 register prscm0 register 1/2 2 internal bus clock control selector selector selector selector selector remark f x : main clock oscillation frequency f bgcs : watch timer source clock frequency f brg : watch timer count clock frequency f xt : subclock frequency f w : watch timer clock frequency intwt: watch timer interrupt request signal intwti: interval timer interrupt request signal
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 423 (1) clock control this block controls supplying and stopping the operating clock (f x ) when the watch timer operates on the main clock. (2) 3-bit prescaler this prescaler divides f x to generate f x /2, f x /4, or f x /8. (3) 8-bit counter this 8-bit counter counts the source clock (f bgcs ). (4) 11-bit prescaler this prescaler divides f w to generate a clock of f w /2 4 to f w /2 11 . (5) 5-bit counter this counter counts f w or f w /2 9 , and generates a watch timer interrupt request signal at intervals of 2 4 /f w , 2 5 /f w , 2 12 /f w , or 2 14 /f w . (6) selector the watch timer has the following five selectors. ? selector that selects one of f x , f x /2, f x /4, or f x /8 as the source clock of the watch timer ? selector that selects the main clock (f x ) or subclock (f xt ) as the clock of the watch timer ? selector that selects f w or f w /2 9 as the count clock frequency of the 5-bit counter ? selector that selects 2 4 /f w , 2 13 /f w , 2 5 /f w , or 2 14 /f w as the intwt signal generation time interval ? selector that selects 2 4 /f w to 2 11 /f w as the interval timer interrupt re quest signal (intwti) generation time interval (7) prscm register this is an 8-bit compare register that sets the interval time. (8) prsm register this register controls clock supply to the watch timer. (9) wtm register this is an 8-bit register that contro ls the operation of the watch timer/in terval timer, and sets the interrupt request signal generation interval.
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 424 10.3 control registers the following registers are provided for the watch timer. ? prescaler mode register 0 (prsm0) ? prescaler compare register 0 (prscm0) ? watch timer operation mode register (wtm) (1) prescaler mode register 0 (prsm0) the prsm0 register controls the generat ion of the watch timer count clock. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 prsm0 0 0 bgce0 0 0 bgcs01 bgcs00 disabled enabled bgce0 0 1 main clock operation enable f x f x /2 f x /4 f x /8 5 mhz 200 ns 400 ns 800 ns 1.6 s 4 mhz 250 ns 500 ns 1 s 2 s bgcs01 0 0 1 1 bgcs00 0 1 0 1 selection of watch timer source clock (f bgcs ) after reset: 00h r/w address: fffff8b0h < > cautions 1. do not change the values of the bgcs00 and bgcs01 bits during watch timer operation. 2. set the prsm0 register befo re setting the bgce0 bit to 1. 3. set the prsm0 and prscm0 registers accordi ng to the main clock fr equency that is used so as to obtain an f brg frequency of 32.768 khz.
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 425 (2) prescaler compare register 0 (prscm0) the prscm0 register is an 8-bit compare register. this register can be read or written in 8-bit units. reset sets this register to 00h. prscm07 prscm0 prscm06 prscm05 prscm04 prscm03 prscm02 prscm01 prscm00 after reset: 00h r/w address: fffff8b1h cautions 1. do not rewrite the prscm0 register during watc h timer operation. 2. set the prscm0 register before setting the prsm0.bgce0 bit to 1. 3. set the prsm0 and prscm0 registers accordi ng to the main clock fr equency that is used so as to obtain an f brg frequency of 32.768 khz. the calculation for f brg is shown below. f brg = f bgcs /2n remark f bgcs : watch timer source clock set by the prsm0 register n: set value of prscm0 register = 1 to 256 however, n = 256 only when prscm0 register is set to 00h.
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 426 (3) watch timer operation mode register (wtm) the wtm register enables or di sables the count clock and operation of t he watch timer, sets the interval time of the prescaler, controls the operat ion of the 5-bit counter, and sets the set time of the watch flag. set the prsm0 register before setting the wtm register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. (1/2) wtm7 2 4 /f w (488 s: f w = f xt ) 2 5 /f w (977 s: f w = f xt ) 2 6 /f w (1.95 ms: f w = f xt ) 2 7 /f w (3.91 ms: f w = f xt ) 2 8 /f w (7.81 ms: f w = f xt ) 2 9 /f w (15.6 ms: f w = f xt ) 2 10 /f w (31.3 ms: f w = f xt ) 2 11 /f w (62.5 ms: f w = f xt ) 2 4 /f w (488 s: f w = f brg ) 2 5 /f w (977 s: f w = f brg ) 2 6 /f w (1.95 ms: f w = f brg ) 2 7 /f w (3.90 ms: f w = f brg ) 2 8 /f w (7.81 ms: f w = f brg ) 2 9 /f w (15.6 ms: f w = f brg ) 2 10 /f w (31.2 ms: f w = f brg ) 2 11 /f w (62.5 ms: f w = f brg ) wtm7 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 wtm6 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 selection of interval time of prescaler wtm wtm6 wtm5 wtm4 wtm3 wtm2 wtm1 wtm0 wtm5 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 wtm4 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 after reset: 00h r/w address: fffff680h < > < >
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 427 (2/2) 2 14 /f w (0.5 s: f w = f xt ) 2 13 /f w (0.25 s: f w = f xt ) 2 5 /f w (977 s: f w = f xt ) 2 4 /f w (488 s: f w = f xt ) 2 14 /f w (0.5 s: f w = f brg ) 2 13 /f w (0.25 s: f w = f brg ) 2 5 /f w (977 s: f w = f brg ) 2 4 /f w (488 s: f w = f brg ) wtm7 0 0 0 0 1 1 1 1 selection of set time of watch flag clears after operation stops starts wtm1 0 1 control of 5-bit counter operation wtm3 0 0 1 1 0 0 1 1 wtm2 0 1 0 1 0 1 0 1 stops operation (clears both prescaler and 5-bit counter) enables operation wtm0 0 1 watch timer operation enable caution rewrite the wtm2 to wtm7 bits wh ile both the wtm0 and wtm1 bits are 0. remarks 1. f w : watch timer clock frequency 2. values in parentheses apply to operation with f w = 32.768 khz
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 428 10.4 operation 10.4.1 operation as watch timer the watch timer generates an interrupt request signal (int wt) at fixed time intervals. the watch timer operates using time intervals of 0.25 or 0.5 seconds wi th the subclock (32.768 khz) or main clock. the count operation starts when the wtm.wtm1 and wtm.wtm0 bits are set to 11. when the wtm0 bit is cleared to 0, the 11-bit prescaler and 5-bit co unter are cleared and the count operation stops. the time of the watch timer can be adjusted by clearin g the wtm1 bit to 0 and then the 5-bit counter when operating at the same time as the interval timer. at this time, an error of up to 15.6 ms may occur for the watch timer, but the interval timer is not affected. if the main clock is used as the count clock of the watc h timer, set the count clock using the prsm0.bgcs01 and bgcs00 bits, the 8-bit comparison value using the prscm0 register, and the count clock frequency (f brg ) of the watch timer to 32.768 khz. when the prsm0.bgce0 bit is set (1), f brg is supplied to the watch timer. f brg can be calculated by the following expression. f brg = f x /(2 m+1 n) to set f brg to 32.768 khz, perform the following calculat ion and set the bgcs01 and bgcs00 bits and the prscm0 register. <1> set n = f x /65,536. set m = 0. <2> when the value resulting from rounding up the first dec imal place of n is even, set n before the roundup as n/2 and m as m + 1. <3> repeat <2> until n is odd or m = 3. <4> set the value resulting from rounding up the first dec imal place of n to the prscm0 register and m to the bgcs01 and bgcs00 bits. example: when f x = 4.00 mhz <1> n = 4,000,000/65,536 = 61.03?, m = 0 <2>, <3> because n (round up the first decimal place) is odd, n = 61, m = 0. <4> set value of prscm0 register: 3dh (61), set value of bgcs01 and bgcs00 bits: 00 at this time, the actual f brg frequency is as follows. f brg = f x /(2 m+1 n) = 4,000,000/(2 61) = 32.787 khz remark m: division value (set value of bgcs01 and bgcs00 bits) = 0 to 3 n: set value of prscm0 register = 1 to 256 however, n = 256 only when prscm0 register is set to 00h. f x : main clock oscillation frequency
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 429 10.4.2 operation as in terval timer the watch timer can also be used as an interval time r that repeatedly generates an interrupt request signal (intwti) at intervals specifie d by a preset count value. the interval time can be selected by the wt m4 to wtm7 bits of the wtm register. table 10-1. interval time of interval timer wtm7 wtm6 wtm5 wtm4 interval time 0 0 0 0 2 4 1/fw 488 s (operating at f w = f xt = 32.768 khz) 0 0 0 1 2 5 1/fw 977 s (operating at f w = f xt = 32.768 khz) 0 0 1 0 2 6 1/fw 1.95 ms (operating at f w = f xt = 32.768 khz) 0 0 1 1 2 7 1/fw 3.91 ms (operating at f w = f xt = 32.768 khz) 0 1 0 0 2 8 1/fw 7.81 ms (operating at f w = f xt = 32.768 khz) 0 1 0 1 2 9 1/fw 15.6 ms (operating at f w = f xt = 32.768 khz) 0 1 1 0 2 10 1/fw 31.3 ms (operating at f w = f xt = 32.768 khz) 0 1 1 1 2 11 1/fw 62.5 ms (operating at f w = f xt = 32.768 khz) 1 0 0 0 2 4 1/fw 488 s (operating at f w = f brg = 32.768 khz) 1 0 0 1 2 5 1/fw 977 s (operating at f w = f brg = 32.768 khz) 1 0 1 0 2 6 1/fw 1.95 ms (operating at f w = f brg = 32.768 khz) 1 0 1 1 2 7 1/fw 3.91 ms (operating at f w = f brg = 32.768 khz) 1 1 0 0 2 8 1/fw 7.81 ms (operating at f w = f brg = 32.768 khz) 1 1 0 1 2 9 1/fw 15.6 ms (operating at f w = f brg = 32.768 khz) 1 1 1 0 2 10 1/fw 31.3 ms (operating at f w = f brg = 32.768 khz) 1 1 1 1 2 11 1/fw 62.5 ms (operating at f w = f brg = 32.768 khz) remark f w : watch timer clock frequency
chapter 10 watch timer functions preliminary user's manual u17714ej1v0ud 430 figure 10-2. operation timing of watch timer/interval timer start overflow overflow 0h interrupt time of watch timer (0.5 s) interrupt time of watch timer (0.5 s) interval time (t) interval time (t) nt nt 5-bit counter count clock f w or f w /2 9 watch timer interrupt intwt interval timer interrupt intwti remarks 1. when 0.5 seconds of the watch timer interrupt time is set. 2. f w : watch timer clock frequency values in parentheses apply to operation with f w = 32.768 khz. n: number of interval timer operations 10.4.3 cautions some time is required before the first watch timer interr upt request signal (intwt) is generated after operation is enabled (wtm.wtm1 and wtm.wtm0 bits = 1). figure 10-3. example of generation of watc h timer interrupt request signal (intwt) (when interrupt cycle = 0.5 s) it takes 0.515625 seconds (max.) for the first intwt signal to be generated (2 9 1/32768 = 0.015625 seconds longer (max.)). the intwt signal is then generated every 0.5 seconds. 0.5 s 0.5 s 0.515625 s wtm0, wtm1 intwt
preliminary user's manual u17714ej1v0ud 431 chapter 11 functions of watchdog timer 2 11.1 functions watchdog timer 2 has the following functions. ? default-start watchdog timer note 1 reset mode: reset operation upon overflow of wa tchdog timer 2 (generation of wdt2res signal) non-maskable interrupt request mode: nmi operation upon overflow of watchdog timer 2 (generation of intwdt2 signal) note 2 ? input selectable from main clock, internal os cillation clock, and subclock as the source clock notes 1. watchdog timer 2 automatically starts in the reset mode following reset release. when watchdog timer 2 is not used, either stop its operation before reset is executed via this function, or clear watchdog timer 2 once and stop it within the next interval time. also, write to the wdtm2 register for verifi cation purposes only once, even if the default settings (reset mode, interval time: f r /2 19 ) do not need to be changed. 2. for the non-maskable interrupt servicing due to a non-maskable interrupt request signal (intwdt2), see 19.2.2 (2) from intwdt2 signal .
chapter 11 functions of watchdog timer 2 preliminary user's manual u17714ej1v0ud 432 11.2 configuration the following shows the block diagram of watchdog timer 2. figure 11-1. block diag ram of watchdog timer 2 f xx /2 9 clock input controller output controller wdt2res (internal reset signal) wdcs22 internal bus intwdt2 wdcs21 wdcs20 f xt wdcs23 wdcs24 0 wdm21 wdm20 selector 16-bit counter f xx /2 18 to f xx /2 25 , f xt /2 9 to f xt /2 16 , f r /2 12 to f r /2 19 watchdog timer enable register (wdte) watchdog timer mode register 2 (wdtm2) 3 3 2 clear f r /2 3 remark f xx : main clock frequency f xt : subclock frequency f r : internal oscillation clock frequency intwdt2: non-maskable interrupt request signal from watchdog timer 2 wdtres2: watchdog timer 2 reset signal watchdog timer 2 includes the following hardware. table 11-1. configuration of watchdog timer 2 item configuration control registers watchdog timer mode register 2 (wdtm2) watchdog timer enable register (wdte)
chapter 11 functions of watchdog timer 2 preliminary user's manual u17714ej1v0ud 433 11.3 registers (1) watchdog timer mode register 2 (wdtm2) the wdtm2 register sets the overflow time and operation clock of watchdog timer 2. this register can be read or written in 8-bit units. this register can be read any number of times, but it can be written only once following reset release. reset sets this register to 67h. caution accessing the wdtm2 register is prohibited in th e following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock a nd the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock 0 wdtm2 wdm21 wdm20 wdcs24 wdcs23 wdcs22 wdcs21 wdcs20 after reset: 67h r/w address: fffff6d0h stops operation non-maskable interrupt request mode (generation of intwdt2 signal) reset mode (generation of wdt2res signal) wdm21 0 0 1 wdm20 0 1 selection of operation mode of watchdog timer 2 cautions 1. for details of the wdcs20 to w dcs24 bits, see table 11-2 watchdog timer 2 clock selection. 2. although watchdog timer 2 can be stopped just by stopping the operation of the internal oscillator, clear the wdtm2 re gister to 00h to securely st op the timer (to avoid selection of the main clock or subclock due to an erroneous write operation). 3. if the wdtm2 register is rewritten twice after reset, an overflow signal is forcibly generated and the counter is reset. 4. to intentionally generate an overflow si gnal, write to the wdtm2 register only twice or write a value other than ach to the wdte register once. 5. to stop the operation of watchdog timer 2, set the rcm.rstp bit to 1 (to stop the internal oscillator) and write 00h in the wdtm2 register . if the rcm.rstp bit cannot be set to 1, set the wdcs23 bit to 1 (2 n /f xx is selected and the clock can be stopped in the idle1, idlw2, sub-idle, and s ubclock operation modes).
chapter 11 functions of watchdog timer 2 preliminary user's manual u17714ej1v0ud 434 table 11-2. watchdog timer 2 clock selection wdcs24 wdcs23 wdcs22 wdcs21 wdcs 20 selected clock 100 khz (min.) 200 khz (typ.) 400 khz (max.) 0 0 0 0 0 2 12 /f r 41.0 ms 20.5 ms 10.2 ms 0 0 0 0 1 2 13 /f r 81.9 ms 41.0 ms 20.5 ms 0 0 0 1 0 2 14 /f r 163.8 ms 81.9 ms 41.0 ms 0 0 0 1 1 2 15 /f r 327.7 ms 163.8 ms 81.9 ms 0 0 1 0 0 2 16 /f r 655.4 ms 327.7 ms 163.8 ms 0 0 1 0 1 2 17 /f r 1,310.7 ms 655.4 ms 327.7 ms 0 0 1 1 0 2 18 /f r 2,621.4 ms 1,310.7 ms 655.4 ms 0 0 1 1 1 2 19 /f r 5,242.9 ms 2,621.47 ms 1,310.7 ms f xx = 20 mhz f xx = 16 mhz f xx = 10 mhz 0 1 0 0 0 2 18 /f xx 13.1 ms 16.4 ms 26.2 ms 0 1 0 0 1 2 19 /f xx 26.2 ms 32.8 ms 52.4 ms 0 1 0 1 0 2 20 /f xx 52.4 ms 65.5 ms 104.9 ms 0 1 0 1 1 2 21 /f xx 104.9 ms 131.1 ms 209.7 ms 0 1 1 0 0 2 22 /f xx 209.7 ms 262.1 ms 419.4 ms 0 1 1 0 1 2 23 /f xx 419.4 ms 524.3 ms 838.9 ms 0 1 1 1 0 2 24 /f xx 838.9 ms 1,048.6 ms 1,677.7 ms 0 1 1 1 1 2 25 /f xx 1,677.7 ms 2,097.2 ms 3,355.4 ms f xt = 32.768 khz 1 0 0 0 2 9 /f xt 15.625 ms 1 0 0 1 2 10 /f xt 31.25 ms 1 0 1 0 2 11 /f xt 62.5 ms 1 0 1 1 2 12 /f xt 125 ms 1 1 0 0 2 13 /f xt 250 ms 1 1 0 1 2 14 /f xt 500 ms 1 1 1 0 2 15 /f xt 1,000 ms 1 1 1 1 2 16 /f xt 2,000 ms (2) watchdog timer enable register (wdte) the counter of watchdog timer 2 is cleared and counting restarted by wr iting "ach" to the wdte register. the wdte register can be read or written in 8-bit units. reset sets this register to 9ah. wdte after reset: 9ah r/w address: fffff6d1h cautions 1. when a value other than "ach" is writ ten to the wdte register , an overflow signal is forcibly output. 2. when a 1-bit memory mani pulation instruction is execute d for the wdte register, an overflow signal is forcibly output. 3. to intentionally ge nerate an overflow signal, write a value other than ach to the wdte register once or write to th e wdtm2 register only twice. 4. the read value of the wdte register is "9ah" (which differs from written value "ach").
chapter 11 functions of watchdog timer 2 preliminary user's manual u17714ej1v0ud 435 11.4 operation watchdog timer 2 automatically starts in t he reset mode following reset release. the wdtm2 register can be written to only once following re set using byte access. to use watchdog timer 2, write the operation mode and the interval time to the wdtm2 register using an 8-bit me mory manipulation instruction. after this, the operation of watchdog timer 2 cannot be stopped. the wdcs24 to wdcs20 bits of the wdtm 2 register are used to select the watchdog timer 2 loop detection time interval. writing ach to the wdte register cl ears the counter of watchdog timer 2 an d starts the count operation again. after the count operation has start ed, write ach to wdte within the loop detection time interval. if the time interval expires without ach being written to the wdte register, a reset signal (wdt2res) or a non- maskable interrupt request signal (intwdt2) is gener ated, depending on the set values of the wdm21 and wdtm2.wdm20 bits. when the wdtm2.wdm21 bit is set to 1 (reset mode), if a wdt overflow occurs during oscillation stabilization after a reset or standby is released, no internal reset will oc cur and the cpu clock will switch to the internal oscillation clock. to not use watchdog timer 2, write 00h to the wdtm2 register. for the non-maskable interrupt servicing while t he non-maskable interrupt request mode is set, see 19.2.2 (2) from intwdt2 signal .
preliminary user's manual u17714ej1v0ud 436 chapter 12 real-time output function (rto) 12.1 function the real-time output function transfers preset data to the rtbln and rtbh n registers, and then transfers this data by hardware to an external device via the output latches, upon occurrence of a timer interrupt. the pins through which the data is output to an external device constitute a port called the real-tim e output function (rto). because rto can output signals without jitter, it is suitable for controlling a stepper motor. in the v850es/jj2, two 6-bit real-time output port channels are provided. the real-time output port can be se t to the port mode or real-time output port mode in 1-bit units. remark n = 0, 1
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 437 12.2 configuration the block diagram of rto is shown below. figure 12-1. block diagram of rto inttp0cc0, inttp6cc0 note 1 inttp5cc0, inttp8cc0 note 2 inttp4cc0, inttp7cc0 note 3 rtpoen rtpegn byten extrn rtpmn5 rtpmn4 rtpmn3 rtpmn2 rtpmn1 rtpmn0 4 2 2 4 rtpn4, rtpn5 rtpn0 to rtpn3 real-time output buffer register nh (rtbhn) real-time output latch nh selector real-time output latch nl real-time output port control register n (rtpcn) transfer trigger (h) transfer trigger (l) real-time output port mode register n (rtpmn) internal bus real-time output buffer register nl (rtbln) notes 1. inttp0cc0 when n = 0, inttp6cc0 when n = 1 2. inttp5cc0 when n = 0, inttp8cc0 when n = 1 3. inttp4cc0 when n = 0, inttp7cc0 when n = 1 remark n = 0, 1 rto includes the following hardware. table 12-1. configuration of rto item configuration registers real-time output buffer r egisters nl, nh (rtbln, rtbhn) control registers real-time output port mode register n (rtpmn) real-time output port control register n (rtpcn)
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 438 (1) real-time output buffer registers nl, nh (rtbln, rtbhn) the rtbln and rtbhn registers are 4-bit registers that hold preset output data. these registers are mapped to independent addresses in the peripheral i/o register area. these registers can be read or wr itten in 8-bit or 1-bit units. reset sets these registers to 00h. if an operation mode of 4 bits 1 channel or 2 bits 1 channel is specified (rtpcn.byten bit = 0), data can be individually set to the rtbln and rtbhn registers. the data of both these r egisters can be read at once by specifying the address of either of these registers. if an operation mode of 6 bits 1 channel is specified (byten bit = 1), 8-bit data can be set to both the rtbln and rtbhn registers by writing the da ta to either of these registers. moreover, the data of both these registers can be read at once by specifying the address of either of these registers. table 12-2 shows the operation when the rt bln and rtbhn register s are manipulated. 0 rtbln rtbhn 0 rtbhn5 rtbhn4 rtbln3 rtbln2 rtbln1 rtbln0 after reset: 00h r/w address: rtbl0 fffff6e0h, rtbh0 fffff6e2h, rtbl1 fffff6f0h, rtbh1 fffff6f2h cautions 1. when writing to bits 6 and 7 of the rtbhn register, always write 0. 2. accessing the rtbln and rtbhn regi sters is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-ch ip peripheral i/o registers. ? when the cpu operates with the subc lock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock remark n = 0, 1 table 12-2. operation during manipulation of rtbln and rtbhn registers read write note operation mode register to be manipulated higher 4 bits lower 4 bits higher 4 bits lower 4 bits rtbln rtbhn rtbln invalid rtbln 4 bits 1 channel, 2 bits 1 channel rtbhn rtbhn rtbln rtbhn invalid rtbln rtbhn rtbln rtbhn rtbln 6 bits 1 channel rtbhn rtbhn rtbln rtbhn rtbln note after setting the real-time output port, set output data to the rtbln and rtbhn registers by the time a real- time output trigger is generated.
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 439 12.3 registers rto is controlled using the following two registers. ? real-time output port mode register n (rtpmn) ? real-time output port control register n (rtpcn) (1) real-time output port mode register n (rtpmn) the rtpmn register selects t he real-time output port mode or port mode in 1-bit units. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 rtpmnm 0 1 real-time output disabled real-time output enabled control of real-time output port (m = 0 to 5) rtpmn (n = 0, 1) 0 rtpmn5 rtpmn4 rtpmn3 rtpmn2 rtpmn1 rtpmn0 after reset: 00h r/w address: rtpm0 fffff6e4h, rtpm1 fffff6f4h cautions 1. by enabling the r eal-time output operation (rtpcn.rtpoen bit = 1), the bits enabled to real-time output among the rt pn0 to rtpn5 signals perform real- time output, and the bits set to port mode output 0. 2. if real-time output is disabled (r tpoen bit = 0), the real-time output pins (rtpn0 to rtpn5) all output 0, rega rdless of the rtpmn register setting. 3. in order to use this register as the real-time output pins (rtpn0 to rtpn5), set these pins as real-time output port pins using the pmc and pfc registers.
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 440 (2) real-time output port control register n (rtpcn) the rtpcn register is a register that sets the operat ion mode and output trigger of the real-time output port. the relationship between the operation mo de and output trigger of the real -time output port is as shown in tables 12-3 and 12-4. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. rtpoen disables operation note 1 enables operation rtpoen 0 1 control of real-time output operation rtpcn (n = 0, 1) rtpegn byten extrn 0 0 0 0 falling edge note 2 rising edge rtpegn 0 1 valid edge of inttpacc0 (n = 0, a = 0, 4, 5) and inttpbcc0 (n = 1, b = 6 to 8) signals 4 bits 2 channels, 2 bits 2 channels 6 bits 2 channels byten 0 1 specification of channel configuration for real-time output after reset: 00h r/w address: rtpc0 fffff6e5h, rtpc1 fffff6f5h < > notes 1. when the real-time output oper ation is disabled (rtpoen bit = 0), all the bits of the real-time output signals (rtpn0 to rtpn5) output "0". 2. the inttp0cc0 and inttp6cc0 signals are output for 1 clock of the count clock selected by tmp0 or tmp6. caution set the rtpegn, byten, and ext rn bits only when rtpoen bit = 0. table 12-3. operation modes and output trig gers of real-time output port (n = 0) byte0 extr0 operation mode rtbh0 (rtp 04, rtp05) rtbl0 (rtp00 to rtp03) 0 inttp5cc0 inttp4cc0 0 1 4 bits 1 channel, 2 bits 1 channel inttp4cc0 inttp0cc0 0 inttp4cc0 1 1 6 bits 1 channel inttp0cc0 table 12-4. operation modes and output trig gers of real-time output port (n = 1) byte1 extr1 operation mode rtbh1 (rtp 14, rtp15) rtbl1 (rtp10 to rtp13) 0 inttp8cc0 inttp7cc0 0 1 4 bits 1 channel, 2 bits 1 channel inttp7cc0 inttp6cc0 0 inttp7cc0 1 1 6 bits 1 channel inttp6cc0
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 441 12.4 operation if the real-time output operation is enabled by setting the rtpcn.rtpoen bi t to 1, the data of the rtbhn and rtbln registers is transferred to the real-time output latch in synchronizati on with the generation of the selected transfer trigger (set by the rtpcn.extrn and rtpcn.byten bits). of the trans ferred data, only the data of the bits for which real-time output is enabled by the rtpmn register is output from t he rtpn0 to rtpn5 bits. the bits for which real-time output is disabled by the rtpmn register output 0. if the real-time output operatio n is disabled by clearing the rtpoen bit to 0, the rtpn0 to rtpn5 signals output 0 regardless of the setting of the rtpmn register. figure 12-2. example of operation timing of rto0 (when extr0 bit = 0, byte0 bit = 0) abababab d01 d02 d03 d04 d11 d12 d13 d14 d11 d12 d13 d14 d01 d02 d03 d04 inttp5cc0 (internal) inttp4cc0 (internal) cpu operation rtbh0 rtbl0 rt output latch 0 (h) rt output latch 0 (l) a: software processing by inttp5cc0 interrupt request (rtbh0 write) b: software processing by inttp4cc0 interrupt request (rtbl0 write) remark for the operation during standby, see chapter 21 standby function .
chapter 12 real-time output function (rto) preliminary user's manual u17714ej1v0ud 442 12.5 usage (1) disable real-time output. clear the rtpcn.rtpoen bit to 0. (2) perform initialization as follows. ? set the alternate-function pins of port 5 set the pfc5.pfc5m bit and pfce5.pfce5m bit to 1, and then set the pmc5.pmc5m bit to 1 (m = 0 to 5). ? specify the real-time output port mode or port mode in 1-bit units. set the rtpmn register. ? channel configuration: select the trigger and valid edge. set the rtpcn.extrn, rtpcn. byten, and rtpcn.rtpegn bits. ? set the initial values to the rtbhn and rtbln registers note 1 . (3) enable real-time output. set the rtpoen bit = 1. (4) set the next output value to the rtbhn and rtbln registers by the time the selected transfer trigger is generated note 2 . (5) set the next real-time output value to the rtbhn and rt bln registers via interrupt servicing corresponding to the selected trigger. notes 1. if the rtbhn and rtbln registers are written when the rtpoen bit = 0, that value is transferred to real-time output latches nh and nl, respectively. 2. even if the rtbhn and rtbln r egisters are written when the rt poen bit = 1, data is not transferred to real-time output latches nh and nl. 12.6 cautions (1) prevent the following conflicts by software. ? conflict between real-time output disable/enable switching (rtpoen bi t) and selected real-time output trigger. ? conflict between writing to the rtbhn and rtbln regist ers in the real-time output enabled status and the selected real-time output trigger. (2) before performing initialization, disable real-time output (rtpoen bit = 0). (3) once real-time output has been disabled (rtpoen bit = 0), be sure to initialize the rtbhn and rtbln registers before enabling real-time output again (rtpoen bit = 0 1).
preliminary user's manual u17714ej1v0ud 443 chapter 13 a/d converter 13.1 overview the a/d converter converts analog input signals into digital values, has a resolution of 10 bits, and can handle 16 analog input signal channels (ani0 to ani15). the a/d converter has the following features. 10-bit resolution 16 channels successive approximation method operating voltage: av ref0 = 3.0 to 3.6 v analog input voltage: 0 v to av ref0 the following functions are provided as operation modes. ? continuous select mode ? continuous scan mode ? one-shot select mode ? one-shot scan mode the following functions are provided as trigger modes. ? software trigger mode ? external trigger mode (external, 1) ? timer trigger mode power-fail monitor function (conversion result compare function) 13.2 functions (1) 10-bit resolution a/d conversion an analog input channel is selected from ani0 to an i15, and an a/d conversion op eration is repeated at a resolution of 10 bits. each time a/d conversion has been completed, an interrupt request signal (intad) is generated. (2) power-fail detection function this function is used to detect a drop in the battery volt age. the result of a/d conversion (the value of the ada0crnh register) is compared with the value of t he ada0pft register, and the intad signal is generated only when a specified comparison condition is satisfied (n = 0 to 15).
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 444 13.3 configuration the block diagram of the a/d converter is shown below. figure 13-1. block diagram of a/d converter ani0 : : ani1 ani2 ani13 ani14 ani15 ada0m2 ada0m1 ada0m0 ada0s ada0pft controller voltage comparator ada0pfm voltage comparator ada0cr0 ada0cr1 : : ada0cr2 ada0cr14 ada0cr15 internal bus av ref0 ada0ce bit av ss intad edge detection adtrg controller sample & hold circuit tap selector ada0ets0 bit inttp2cc0 inttp2cc1 ada0ets1 bit ada0ce bit ada0tmd1 bit ada0tmd0 bit selector selector ada0pfe bit ada0pfc bit sar the a/d converter includes the following hardware. table 13-1. configuration of a/d converter item configuration analog inputs 16 channels (ani0 to ani15 pins) registers successive approximation register (sar) a/d conversion result registers 0 to 15 (ada0cr0 to ada0cr15) a/d conversion result registers 0h to 15h (adcr0h to adcr15h): only higher 8 bits can be read control registers a/d converter mode registers 0 to 2 (ada0m0 to ada0m2) a/d converter channel specification register 0 (ada0s) power fail compare mode register (ada0pfm) power fail compare threshold value register (ada0pft)
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 445 (1) successive approximation register (sar) the sar register compares the volta ge value of the analog input signal with the voltage tap (compare voltage) value from the series resistor string, and holds the co mparison result starting from the most significant bit (msb). when the comparison result has been held down to the le ast significant bit (lsb) (i.e., when a/d conversion is complete), the contents of the sar register are transferred to the ada0crn register. remark n = 0 to 15 (2) a/d conversion result register n (ada0crn), a/d conversion result register nh (ada0crnh) the ada0crn register is a 16-bit regi ster that stores the a/d conversi on result. ada0arn consist of 16 registers and the a/d conversion result is stored in the 10 higher bits of the ad0crn register corresponding to analog input. (the lower 6 bits are fixed to 0.) (3) a/d converter mode register 0 (ada0m0) this register specifies the operation mode and cont rols the conversion operation by the a/d converter. (4) a/d converter mode register 1 (ada0m1) this register sets the conversion time of the analog input signal to be converted. (5) a/d converter mode register 2 (ada0m2) this register sets the hardware trigger mode. (6) a/d converter channel specification register (ada0s) this register sets the input port that inputs the analog voltage to be converted. (7) power-fail compare m ode register (ada0pfm) this register sets the power-fail monitor mode. (8) power-fail compare threshol d value register (ada0pft) the ada0pft register sets a threshold value that is co mpared with the value of a/d conversion result register nh (ada0crnh). the 8-bit data set to the ada0pft regi ster is compared with the hi gher 8 bits of the a/d conversion result register (ada0crnh). (9) controller the controller compares the result of the a/d conversion (the value of the ada0crnh register) with the value of the ada0pft register when a/d conversion is comp leted or when the power-fail detection function is used, and generates the intad signal only when a spec ified comparison condition is satisfied. (10) sample & hold circuit the sample & hold circuit samples each of the analog input signals selected by the input circuit and sends the sampled data to the voltage comparator. this circuit also holds the sampled analog input signal voltage during a/d conversion. (11) voltage comparator the voltage comparator compares a voltage value that has been sample d and held with the voltage value of the series resistor string.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 446 (12) series resistor string this series resistor string is connected between av ref0 and av ss and generates a voltage for comparison with the analog input signal. (13) ani0 to ani15 pins these are analog input pins for the 16 a/d converter channels and are used to input analog signals to be converted into digital signals. pins other than the one selected as the analog input by the ada0s register can be used as input port pins. caution make sure that the voltag es input to the ani0 to ani15 pins do not exceed the rated values. in particular if a voltage of av ref0 or higher is input to a channel, the conversion value of that channel becomes undefined, and the conver sion values of the other channels may also be affected. (14) av ref0 pin this is the pin used to input the reference voltage of t he a/d converter. always make the potential at this pin the same as that at the v dd pin even when the a/d converter is not us ed. the signals input to the ani0 to ani15 pins are converted to digital signal s based on the voltage applied between the av ref0 and av ss pins. (15) av ss pin this is the ground pin of t he a/d converter. always make the potential at this pin the same as that at the v ss pin even when the a/d converter is not used.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 447 13.4 registers the a/d converter is controlled by the following registers. ? a/d converter mode registers 0, 1, 2 (ada0m0, ada0m1, ada0m2) ? a/d converter channel specification register 0 (ada0s) ? power-fail compare mode register (ada0pfm) the following registers are also used. ? a/d conversion result register n (ada0crn) ? a/d conversion result register nh (ada0crnh) ? power-fail compare threshold value register (ada0pft) (1) a/d converter mode register 0 (ada0m0) the ada0m0 register is an 8-bit register that specif ies the operation mode and controls conversion operations. this register can be read or written in 8-bit or 1-bit units. however, ada0ef bit is read-only. reset sets this register to 00h. caution accessing the ada0m0 register is prohibited in the following statuses. for details, see 3.4.8 (2) accessing specific on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock (1/2) ada0ce ada0ce 0 1 stops a/d conversion enables a/d conversion a/d conversion control ada0m0 0 <7>65432 1<0> ada0md1 ada0md0 ada0ets1 ada0ets0 ada0tmd ada0ef ada0md1 0 0 1 1 ada0md0 0 1 0 1 continuous select mode continuous scan mode one-shot select mode one-shot scan mode specification of a/d converter operation mode after reset: 00h r/w address: fffff200h
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 448 (2/2) ada0tmd 0 1 software trigger mode external trigger mode/timer trigger mode trigger mode specification ada0ef 0 1 a/d conversion stopped a/d conversion in progress a/d converter status display ada0ets1 0 0 1 1 ada0ets0 0 1 0 1 no edge detection falling edge detection rising edge detection detection of both rising and falling edges specification of external trigger (adtrg pin) input valid edge cautions 1. a write operation to bit 0 is ignored. 2. changing the ada0m1.ada0fr2 to ada0 m1.ada0fr0 bits is prohibited while a/d conversion is enabled (ada0ce bit = 1). 3. when writing data to th e ada0m0, ada0m2, ada0s, ada0pfm, or ada0pft register in the following modes, stop the a/d conversion by clearing the ada0ce bit to 0. after the data is written to the register, enab le the a/d conversion again by setting the ada0ce bit to 1. ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode if the ada0m0, ada0m2, ada0s, ada0pfm, and ada0pft registers are written in the other modes during a/d conversion (ada0ef bit = 1), the following will be performed according to the mode. ? in software trigger mode a/d conversion is stopped and started again from the beginning. ? in hardware trigger mode a/d conversion is stopped, and th e trigger standby status is set. 4. to select the external trigger mode/timer trigger mode (ada0tmd bit = 1), set the high- speed conversion mode (ada0m1.ada0hs1 bi t = 1). do not input a trigger during stabilization time that is inserted once af ter the a/d conversion operation is enabled (ada0ce bit = 1). 5. when not using the a/d converter, stop th e operation by setting the ada0ce bit to 0 to reduce the power consumption.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 449 (2) a/d converter mode register 1 (ada0m1) the ada0m1 register is an 8-bit regist er that specifies the conversion time. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. ada0hs1 ada0m1 0 00 0 ada0fr2 ada0fr1 ada0fr0 after reset: 00h r/w address: fffff201h ada0hs1 0 1 normal conversion mode high-speed conversion mode specification of normal conversion mode/high-speed mode (a/d conversion time) cautions 1. changing the ada0m1 register is prohibited while a/d conversion is enabled (ada0m0.ada0ce bit = 1). 2. to select the external trigger mode/timer trigger mode (ada0m0.ada0tmd bit = 1), set the high-speed conversion mode (ada0hs1 bit = 1). do not input a trigger during stabilization time that is inserted once af ter the a/d conversion operation is enabled (ada0ce bit = 1). 3. be sure to clear bits 6 to 3 to ?0?. remark for a/d conversion time setting examples, see tables 13-2 and 13-3 .
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 450 table 13-2. conversion time selection in normal conversion mode (ada0hs1 bit = 0) a/d conversion time ada0fr2 to ada0fr0 bits stabilization time + conversion time + wait time f xx = 20 mhz f xx = 16 mhz f xx = 4 mhz trigger response time 000 13/f xx + 26/f xx + 26/f xx setting prohibited setting prohibited 16.25 s 4/f xx 001 26/f xx + 52/f xx + 52/f xx 6.5 s 8.125 s setting prohibited 5/f xx 010 39/f xx + 78/f xx + 78/f xx 9.75 s 12.1875 s setting prohibited 6/f xx 011 50/f xx + 104/f xx + 104/f xx 12.9 s 16.125 s setting prohibited 7/f xx 100 50/f xx + 130/f xx + 130/f xx 15.5 s 19.375 s setting prohibited 8/f xx 101 50/f xx + 156/f xx + 156/f xx 18.1 s 22.625 s setting prohibited 9/f xx 110 50/f xx + 182/f xx + 182/f xx 20.7 s setting prohibited setting prohibited 10/f xx 111 50/f xx + 208/f xx + 208/f xx 23.3 s setting prohibited setting prohibited 11/f xx remark stabilization time: a/d converter setup time (1 s or longer) conversion time: actual a/d conversion time (2.6 to 10.4 s) wait time: wait time inserted before the next conversion trigger response time: if a software trigger, exter nal trigger, or timer trigger is generated after the stabilization time, it is inserted before the conversion time. in the normal conversion mode, the conversion is st arted after the stabilization time elapsed from the ada0m0.ada0ce bit is set to 1, and a/d conversion is performed only during the conversion time (2.6 to 10.4 s). operation is stopped after the conversion ends and the a/d conversion end interrupt request signal (intad) is generated after the wait time is elapsed. because the conversion operation is stopped during the wait time, operation current can be reduced. caution set as 2.6 s conversion time 10.4 s.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 451 table 13-3. conversion time selection in hi gh-speed conversion mode (ada0hs1 bit = 1) a/d conversion time ada0fr2 to ada0fr0 bits conversion time (+ stabilization time) f xx = 20 mhz f xx = 16 mhz f xx = 4 mhz trigger response time 000 26/f xx (+ 13/f xx ) setting prohibited setting prohibited 6.5 s (+ 3.25 s) 4/f xx 001 52/f xx (+ 26/f xx ) 2.6 s (+ 1.3 s) 3.25 s (+ 1.625 s) setting prohibited 5/f xx 010 78/f xx (+ 39/f xx ) 3.9 s (+ 1.95 s) 4.875 s (+ 2.4375 s) setting prohibited 6/f xx 011 104/f xx (+ 50/f xx ) 5.2 s (+ 2.5 s) 6.5 s (+ 3.125 s) setting prohibited 7/f xx 100 130/f xx (+ 50/f xx ) 6.5 s (+ 2.5 s) 8.125 s (+ 3.125 s) setting prohibited 8/f xx 101 156/f xx (+ 50/f xx ) 7.8 s (+ 2.5 s) 9.75 s (+ 3.125 s) setting prohibited 9/f xx 110 182/f xx (+ 50/f xx ) 9.1 s (+ 2.5 s) setting prohibited setting prohibited 10/f xx 111 208/f xx (+ 50/f xx ) 10.4 s (+ 2.5 s) setting prohibited setting prohibited 11/f xx remark conversion time: actual a/d co nversion time (2.6 to 10.4 s) stabilization time: a/d converter setup time (1 s or longer) trigger response time: if a software trigger, exter nal trigger, or timer trigger is generated after the stabilization time, it is inserted before the conversion time. in the high-speed conversion mode, the conversion is started after the stabilization time elapsed from the ada0m0.ada0ce bit is set to 1, and a/d conversion is performed only during the conversion time (2.6 to 10.4 s). the a/d conversion end interrupt request sig nal (intad) is generated immediately after the conversion ends. in continuous conversion mode, the stabilization time is inserted only before the first conversion, and not inserted after the second conversion (the a/d converter remains running). caution set as 2.6 s conversion time 10.4 s.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 452 (3) a/d converter mode register 2 (ada0m2) the ada0m2 register specifies the hardware trigger mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 ada0m2 0 0 0 00 ada0tmd1 ada0tmd0 ada0tmd1 0 0 1 1 ada0tmd0 0 1 0 1 specification of hardware trigger mode external trigger mode (when adtrg pin valid edge detected) timer trigger mode 0 (when inttp2cc0 interrupt request generated) timer trigger mode 1 (when inttp2cc1 interrupt request generated) setting prohibited after reset: 00h r/w address: fffff203h 6543210 7 cautions 1. when writing data to the ada0m2 register in the following modes, stop the a/d conversion by clearing the ad0m0.ada0ce bit to 0. after the data is written to the register, enable the a/d conversion ag ain by setting the ada0ce bit to 1. ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode 2. be sure to clear bits 7 to 2 to ?0?.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 453 (4) a/d converter channel specification register 0 (ada0s) the ada0s register specifies the pin that inputs the analog voltage to be converted into a digital signal. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 ada0s 0 0 0 ada0s3 ada0s2 ada0s1 ada0s0 after reset: 00h r/w address: fffff202h ani0 ani1 ani2 ani3 ani4 ani5 ani6 ani7 ani8 ani9 ani10 ani11 ani12 ani13 ani14 ani15 ani0 ani0, ani1 ani0 to ani2 ani0 to ani3 ani0 to ani4 ani0 to ani5 ani0 to ani6 ani0 to ani7 ani0 to ani8 ani0 to ani9 ani0 to ani10 ani0 to ani11 ani0 to ani12 ani0 to ani13 ani0 to ani14 ani0 to ani15 ada0s3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ada0s2 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 ada0s1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 ada0s0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 select mode scan mode cautions 1. when writing data to the ada0s register in the following modes, stop the a/d conversion by clearing the ad0m0.ada0ce bit to 0. after the data is written to the register, enable the a/d conversion ag ain by setting the ada0ce bit to 1. ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode 2. be sure to clear bits 7 to 4 to ?0?.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 454 (5) a/d conversion result regist ers n, nh (ada0crn, ada0crnh) the ada0crn and ada0crnh registers st ore the a/d conversion results. these registers are read-only, in 16-bit or 8-bit units. however, specify the ada0crn register for 16-bit access and the ada0crnh register for 8-bit access. the 10 bits of the conversion result are read from the higher 10 bits of the ada0crn register, and 0 is read from the lower 6 bits. the higher 8 bits of the conversion result are read from the ada0crnh register. caution accessing the ada0crn and ada0crnh register s is prohibited in the following statuses. for details, see 3.4.8 (2) accessing speci fic on-chip peripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with the internal oscillation clock after reset: undefined r address: ada0cr0 fffff210h, ada0cr1 fffff212h, ada0cr2 fffff214h, ada0cr3 fffff216h, ada0cr4 fffff218h, ada0cr5 fffff21ah, ada0cr6 fffff21ch, ada0cr7 fffff21eh, ada0cr8 fffff220h, ada0cr9 fffff222h, ada0cr10 fffff224h, ada0cr11 fffff226h, ada0cr12 fffff228h, ada0cr13 fffff22ah, ada0cr14 fffff22ch, ada0cr15 fffff22eh ada0crn (n = 0 to 15) ad9 ad8 ad7 ad6 ad0000000 ad1 ad2 ad3 ad4 ad5 ad9 ada0crnh (n = 0 to 15) ad8 ad7 ad6 ad5 ad4 ad3 ad2 76 54 32 1 0 after reset: undefined r address: ada0cr0h fffff211h, ada0cr1h fffff213h, ada0cr2h fffff215h, ada0cr3h fffff217h, ada0cr4h fffff219h, ada0cr5h fffff21bh, ada0cr6h fffff21dh, ada0cr7h fffff21fh, ada0cr8h fffff221h, ada0cr9h fffff223h, ada0cr10h fffff225h, ada0cr11h fffff227h, ada0cr12h fffff229h, ada0cr13h fffff22bh, ada0cr14h fffff22dh, ada0cr15h fffff22fh caution a write operation to the ada0m0 and ad a0s registers may cause the contents of the ada0crn register to become undefined. afte r the conversion, read the conversion result before writing to the ada0m0 and ada0s regi sters. correct conversion results may not be read if a sequence othe r than the above is used.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 455 the relationship between the analog volt age input to the analog input pins (a ni0 to ani15) and the a/d conversion result (ada0crn register) is as follows. v in sar = int ( av ref0 1,024 + 0.5) ada0cr note = sar 64 or, av ref0 av ref0 (sar ? 0.5) 1,024 v in < (sar + 0.5) 1,024 int( ): function that returns the integer of the value in ( ) v in : analog input voltage av ref0 : av ref0 pin voltage ada0cr: value of ada0crn register note the lower 6 bits of the ada0crn register are fixed to 0. the following shows the relationship between the analo g input voltage and the a/d conversion results. figure 13-2. relationship between analog input voltage and a/d conversion results 1,023 1,022 1,021 3 2 1 0 input voltage/av ref0 1 2,048 1 1,024 3 2,048 2 1,024 5 2,048 3 1,024 2,043 2,048 1,022 1,024 2,045 2,048 1,023 1,024 2,047 2,048 1 a/d conversion results ada0crn sar ffc0h ff80h ff40h 00c0h 0080h 0040h 0000h
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 456 (6) power-fail compare m ode register (ada0pfm) the ada0pfm register is an 8-bit register that sets the power-fail compare mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. ada0pfe power-fail compare disabled power-fail compare enabled ada0pfe 0 1 selection of power-fail compare enable/disable ada0pfm ada0pfc 00 00 0 0 generates an interrupt request signal (intad) when ada0crnh ada0pft generates an interrupt request signal (intad) when ada0crnh < ada0pft ada0pfc 0 1 selection of power-fail compare mode after reset: 00h r/w address: fffff204h <7>6543210 cautions 1. in the select mode, the 8-bit data set to the ada0pft regist er is compared with the value of the ada0crnh register specified by the ada0s register. if the result matches the condition specified by the ada0pfc bit, the conversion result is stored in the ada0crn register and the intad signal is ge nerated. if it does not match, however, the interrupt signal is not generated. 2. in the scan mode, the 8-bit data set to the ada0pft register is compared with the contents of the ada0cr0h register. if the result matches the c ondition specified by the ada0pfc bit, the conversion result is stored in the ada0cr0 register and the intad signal is generated. if it does not match, however, the intad signal is not generated. regardless of the comparison r esult, the scan operati on is continued and the conversion result is st ored in the ada0crn register until the scan operation is completed. however, the intad signal is not generated after th e scan operation has been completed. 3. when writing data to the ada0pfm regi ster in the following modes, stop the a/d conversion by clearing the ad0m0.ada0ce bit to 0. after the data is written to the register, enable the a/d conversion ag ain by setting the ada0ce bit to 1. ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 457 (7) power-fail compare thres hold value register (ada0pft) the ada0pft register sets the compare value in the power-fail compare mode. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. ada0pft after reset: 00h r/w address: fffff205h 76 54 321 0 caution when writing data to the ada0pft re gister in the following modes, stop the a/d conversion by clearing the ad0m0.ada0ce bit to 0. after the data is written to the register, enable the a/d conversion ag ain by setting the ada0ce bit to 1. ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 458 13.5 operation 13.5.1 basic operation <1> set the operation mode, trigger mode, and conversion time for executing a/d conversion by using the ada0m0, ada0m1, ada0m2, and ada0s registers. when the ada0ce bit of the ada0m0 register is set, conversion is started in the software trigger mode and the a/d converter waits for a trigger in the external or timer trigger mode. <2> when a/d conversion is started, the voltage input to the selected anal og input channel is sampled by the sample & hold circuit. <3> when the sample & hold circuit samples the input cha nnel for a specific time, it enters the hold status, and holds the input analog voltage until a/d conversion is complete. <4> set bit 9 of the successive approximation regi ster (sar). the tap selector selects (1/2) av ref0 as the voltage tap of the series resistor string. <5> the voltage difference between the voltage of the series resistor st ring and the analog input voltage is compared by the voltage comparator. if th e analog input voltage is higher than (1/2) av ref0 , the msb of the sar register remains set. if it is lower than (1/2) av ref0 , the msb is reset. <6> next, bit 8 of the sar register is automatically set and the next comparison is started. depending on the value of bit 9, to which a result has been already set, t he voltage tap of the series resistor string is selected as follows. ? bit 9 = 1: (3/4) av ref0 ? bit 9 = 0: (1/4) av ref0 this voltage tap and the analog input voltage are compared and, depending on the result, bit 8 is manipulated as follows. analog input voltage voltage tap: bit 8 = 1 analog input voltage voltage tap: bit 8 = 0 <7> this comparison is continued to bit 0 of the sar register. <8> when comparison of the 10 bits is complete, the valid di gital result is stored in t he sar register, which is then transferred to and stored in the ada0crn register. after that, an a/d conversion end interrupt request signal (intad) is generated. <9> in one-shot select mode, conversion is stopped note . in one-shot scan mode, conversion is stopped after scanning once note . in continuous select mode, repeat steps <2> to <8> until the ada0m0.ada0ce bit is cleared to 0. in continuous scan mode, repeat steps <2> to <8> for each channel. note in the external trigger mode, timer trigger mode 0, or timer trigger mode 1, the trigger standby status is entered. remark the trigger standby status me ans the status after the stabilization time has passed.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 459 13.5.2 conversion op eration timing figure 13-3. conversion operation timing (continuous conversion) (1) operation in normal conversion mode (ada0hs1 bit = 0) ada0m0.ada0ce bit processing state setup stabilization time conversion time wait time sampling first conversion second conversion setup sampling wait a/d conversion intad signal 2/f xx (max.) 0.5/f xx sampling time (2) operation in high-speed con version mode (ada0hs1 bit = 1) ada0m0.ada0ce bit processing state setup conversion time sampling first conversion second conversion sampling a/d conversion a/d conversion intad signal 0.5/f xx stabilization time 2/f xx (max.) sampling time ada0fr2 to ada0fr0 bits stabilization time conversion time (sampling time) wait time trigger response time 000 13/f xx 26/f xx (4/f xx ) 26/f xx 4/f xx 001 26/f xx 52/f xx (8/f xx ) 52/f xx 5/f xx 010 39/f xx 78/f xx (12/f xx ) 78/f xx 6/f xx 011 50/f xx 104/f xx (16/f xx ) 104/f xx 7/f xx 100 50/f xx 130/f xx (20/f xx ) 130/f xx 8/f xx 101 50/f xx 156/f xx (24/f xx ) 156/f xx 9/f xx 110 50/f xx 182/f xx (28/f xx ) 182/f xx 10/f xx 111 50/f xx 208/f xx (32/f xx ) 208/f xx 11/f xx remark the above timings are when a trigger generates within the stabilization time. if the trigger generates after the stabilization time, a trigger response time is inserted.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 460 13.5.3 trigger mode the timing of starting the conversion oper ation is specified by setting a trigger mode. the trigger mode includes a software trigger mode and hardware trigger modes. the hardware trigger modes include timer trigger modes 0 and 1, and external trigger mode. the ada0m0.ada0tmd bit is us ed to set the trigger mode. the hardware trigger modes are set by the ada0m2.ada0tmd1 and ada0m2.ada0tmd0 bits. (1) software trigger mode when the ada0m0.ada0ce bit is set to 1, the signal of the analog input pin (ani0 to ani15 pin) specified by the ada0s register is converted. when conversion is co mplete, the result is stored in the ada0crn register. at the same time, the a/d conversion end in terrupt request signal (intad) is generated. if the operation mode specified by the ada0m0.ada0md1 and ada0m0.ada0md0 bits is the continuous select/scan mode, the next conversion is started, unless the ada0ce bit is cleared to 0 after completion of the first conversion. conversion is performed once and ends if the operation mode is the one-shot select/scan mode. when conversion is started, the ada0m0.ada0ef bit is set to 1 (indicating that conversion is in progress). if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0 pft register is written during conversion, the conversion is aborted and started again from the beginning. however, writing to these registers is prohibited in the normal conversion mode and one-shot select m ode/one-shot scan mode in the high-speed conversion mode. (2) external trigger mode in this mode, converting the signal of the analog input pin (ani0 to ani15) specified by the ada0s register is started when an external trigger is input (to the adtrg pin). which edge of the external trigger is to be detected (i.e., the rising edge, falling edge, or both ri sing and falling edges) can be specified by using the ada0m0.ada0ets1 and ada0m0.ata0ets0 bits. when the ad a0ce bit is set to 1, the a/d converter waits for the trigger, and starts conversion after the external trigger has been input. when conversion is completed, the re sult of conversion is stored in t he ada0crn register, regardless of whether the continuous select, c ontinuous scan, one-shot select, or one-shot scan mode is set as the operation mode by the ada0md1 and ada0md0 bits. at the same time, the intad signal is generated, and the a/d converter waits for the trigger again. when conversion is started, the ada0ef bit is set to 1 (indicating that conversion is in progress). while the a/d converter is waiting for the trigger, however, the ada0ef bit is cleared to 0 (indicating that conversion is stopped). if the valid trigger is input during the conver sion operation, the conversion is aborted and started again from the beginning. if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0pft r egister is written during the conversion operation, the conversion is not aborted, and the a/d converter wa its for the trigger again. however, writing to these registers is prohibited in the one- shot select mode/one-shot scan mode. caution to select the external trigger mode, set the high-speed conversion mode. do not input a trigger during stabilization time that is inser ted once after the a/d conversion operation is enabled (ada0m0.ada0ce bit = 1). remark the trigger standby status me ans the status after the st abilization time has passed.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 461 (3) timer trigger mode in this mode, converting the signal of the analog input pin (ani0 to ani15) specified by the ada0s register is started by the compare match interrupt request signal (inttp2cc0 or inttp2cc1) of the capture/compare register connected to the timer. the inttp2cc0 or inttp2cc1 signal is selected by the ada0tmd1 and ada0tmd0 bits, and conversion is started at the rising edge of the specified compare match interrupt request signal. when the ada0ce bit is set to 1, the a/d co nverter waits for a trigger, and starts conversion when the compare match interrupt request signal of the timer is input. when conversion is completed, regardless of whether the continuous select, continuous scan, one-shot select, or one-shot scan mode is set as t he operation mode by the ada0md1 and ada0md0 bits, the result of the conversion is stored in the ada0crn register. at the same time, the intad signal is generated, and the a/d converter waits for the trigger again. when conversion is started, the ada0ef bit is set to 1 (indicating that conversion is in progress). while the a/d converter is waiting for the trigger, however, the ada0ef bit is cleared to 0 (indicating that conversion is stopped). if the valid trigger is input during the conver sion operation, the conversion is aborted and started again from the beginning. if the ada0m0, ada0m2, ada0s, ada0pfm, or ada0 pft register is written during conversion, the conversion is stopped and the a/d converter waits for the tri gger again. however, writing to these registers is prohibited in the one-shot select mode/one-shot scan mode. caution to select the timer trigger mode, set the high-speed conversion mode. do not input a trigger during stabilization time that is inserted once after the a/d co nversion operation is enabled (ada0m0.ada0ce bit = 1). remark the trigger standby status me ans the status after the st abilization time has passed.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 462 13.5.4 operation mode four operation modes are available as t he modes in which to set the ani0 to ani15 pins: continuous select mode, continuous scan mode, one-shot sele ct mode, and one-shot scan mode. the operation mode is selected by the ad a0m0.ada0md1 and ada0m0.ada0md0 bits. (1) continuous select mode in this mode, the voltage of one analog input pin selected by the ada0s register is continuously converted into a digital value. the conversion result is stored in the ada0crn register corresponding to the analog input pin. in this mode, an analog input pin corresponds to an ada0crn register on a one-to-one basis. each time a/d conversion is completed, the a/d conversion end interrupt reques t signal (intad) is generated. after completion of conversion, the next conversion is started, unless the ada0m0.ada0ce bit is cleared to 0 (n = 0 to 15). figure 13-4. timing example of continuous se lect mode operation (ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 ( ani1) data 6 (ani1) data 7 (ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 (ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 6 (ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 (2) continuous scan mode in this mode, analog input pins are sequentially selected, from the ani0 pin to the pin specified by the ada0s register, and their values are converted into digital values. the result of each conversion is stored in the ada0cr n register corresponding to the analog input pin. when conversion of the analog input pin specified by the ada0 s register is complete, the intad signal is generated, and a/d conversion is started again from the ani0 pin, unless the ada0ce bit is cleared to 0 (n = 0 to 15).
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 463 figure 13-5. timing example of continuous s can mode operation (ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) data 5 (ani0) data 6 ( ani1) data 7 (ani2) data 1 (ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) data 5 (ani0) data 6 ( ani1) ada0crn intad conversion start set ada0ce bit = 1 ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 464 (3) one-shot select mode in this mode, the voltage on the analog input pin specifie d by the ada0s register is converted into a digital value only once. the conversion result is stored in the ada0crn register corresponding to the analog input pin. in this mode, an analog input pin and an ada0crn register correspond on a one-to-one basis. when a/d conversion has been completed once, the intad signal is generated. the a/d conversion operation is stopped after it has been completed (n = 0 to 15). figure 13-6. timing example of one-shot sel ect mode operation (ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 6 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 conversion end conversion end (4) one-shot scan mode in this mode, analog input pins are sequentially selected, from the ani0 pin to the pin specified by the ada0s register, and their values are converted into digital values. each conversion result is stored in the ada0crn regi ster corresponding to the analog input pin. when conversion of the analog input pin specified by the ada0s register is complete, the intad signal is generated. a/d conversion is stopped after it has been completed (n = 0 to 15).
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 465 figure 13-7. timing example of one-shot s can mode operation (ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 (ani2) data 4 ( ani3) data 1 ( ani0) data 2 (ani1) data 3 (ani2) data 4 (ani3) ada0crn intad conversion start set ada0ce bit = 1 conversion end ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 466 13.5.5 power-fail compare mode the a/d conversion end interrupt re quest signal (intad) c an be controlled as foll ows by the ada0pfm and ada0pft registers. ? when the ada0pfm.ada0pfe bit = 0, the intad signal is generated each time conversion is completed (normal use of the a/d converter). ? when the ada0pfe bit = 1 and when t he ada0pfm.ada0pfc bit = 0, the va lue of the ada0crnh register is compared with the value of the ada0pft register wh en conversion is completed, and the intad signal is generated only if ada0crnh ada0pft. ? when the ada0pfe bit = 1 and when the ada0pfc bit = 1, the value of the ada0cr nh register is compared with the value of the ada0pft register when conversion is completed, and the intad signal is generated only if ada0crnh < ada0pft. remark n = 0 to 15 in the power-fail compare mode, four modes are availabl e as modes in which to set the ani0 to ani15 pins: continuous select mode, continuous scan mode, one-shot select mode, and one-shot scan mode.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 467 (1) continuous select mode in this mode, the result of converting the voltage of t he analog input pin specified by the ada0s register is compared with the set value of the ada0pft register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion result is stored in the ada0crn register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0crn register, and the intad signal is not generated. after completion of the fi rst conversion, the next conversion is started, unless the ada0m0.ada0ce bit is cleared to 0 (n = 0 to 15). figure 13-8. timing example of continuous select mode operation (when power-fail comparison is made: ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 2 (ani1) data 3 (ani1) data 4 (ani1) data 5 ( ani1) data 6 ( ani1) data 7 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 2 ( ani1) data 3 ( ani1) data 4 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 ada0pft unmatch ada0pft unmatch ada0pft match ada0pft match ada0pft match conversion start set ada0ce bit = 1 (2) continuous scan mode in this mode, the results of converting the voltages of the analog input pins sequentially selected from the ani0 pin to the pin specified by the ada0s register are st ored, and the set value of the ada0cr0h register of channel 0 is compared with the value of the ada0pft regi ster. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion resu lt is stored in the ada0cr0 register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0cr0 register, and the intad signal is not generated. after the result of the first conversion has been stored in the ada0cr0 register, the results of sequentially converting the voltages on the analog input pins up to t he pin specified by the ada0 s register are continuously stored. after completion of conversion, the next conv ersion is started from the ani0 pin again, unless the ada0ce bit is cleared to 0.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 468 figure 13-9. timing example of continuous scan mode operation (when power-fail comparison is made: ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) data 5 ( ani0) data 6 ( ani1) data 7 ( ani2) data 1 ( ani0) data 2 (ani1) data 3 ( ani2) data 4 ( ani3) data 5 ( ani0) data 6 ( ani1) ada0crn intad conversion start set ada0ce bit = 1 ada0pft match ada0pft unmatch ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 469 (3) one-shot select mode in this mode, the result of converting the voltage of t he analog input pin specified by the ada0s register is compared with the set value of the ada0pft register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conversion result is stored in the ada0crn register, and the intad signal is generated. if it does not match, the conver sion result is stored in the ada0crn register, and the intad signal is not generated. conversion is stopped after it has been completed. figure 13-10. timing example of on e-shot select mode operation (when power-fail comparison is made: ada0s register = 01h) ani1 a/d conversion data 1 ( ani1) data 6 ( ani1) data 1 data 2 data 3 data 4 data 5 data 6 data 7 data 1 ( ani1) data 6 ( ani1) ada0cr1 intad conversion start set ada0ce bit = 1 conversion start set ada0ce bit = 1 ada0pft match conversion end ada0pft unmatch conversion end (4) one-shot scan mode in this mode, the results of converting the voltages of the analog input pins sequentially selected from the ani0 pin to the pin specified by the ada0s register are st ored, and the set value of the ada0cr0h register of channel 0 is compared with the set value of the ada0p ft register. if the result of power-fail comparison matches the condition set by the ada0pfc bit, the conver sion result is stored in the ada0cr0 register and the intad signal is generated. if it does not match, the conversion result is stored in the ada0cr0 register, and the intad0 signal is not generated. after the re sult of the first conversion has been stored in the ada0cr0 register, the results of converting the si gnals on the analog input pins specified by the ada0s register are sequentially stored. the conver sion is stopped after it has been completed.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 470 figure 13-11. timing example of one-shot scan mode operation (when power-fail comparison is made: ada0s register = 03h) (a) timing example a/d conversion data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) data 1 ( ani0) data 2 ( ani1) data 3 ( ani2) data 4 ( ani3) ada0crn intad conversion start set ada0ce bit = 1 conversion end ada0pft match ani3 ani0 ani1 ani2 data 1 data 2 data 3 data 4 data 6 data 5 data 7 (b) block diagram a/d converter ada0crn register analog input pin ani0 ani1 ani2 ani3 ani4 ani5 ani13 ani14 ani15 . . . . ada0cr0 ada0cr1 ada0cr2 ada0cr3 ada0cr4 ada0cr5 ada0cr13 ada0cr14 ada0cr15 . . .
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 471 13.6 cautions (1) when a/d converter is not used when the a/d converter is not used, the power consumption can be reduced by clearing the ada0m0.ada0ce bit to 0. (2) input range of ani0 to ani15 pins input the voltage within the specified range to the ani0 to ani15 pi ns. if a voltage equal to or higher than av ref0 or equal to or lower than av ss (even within the range of the absolute maximum ratings) is input to any of these pins, the conversion valu e of that channel is u ndefined, and the conversi on value of the other channels may also be affected. (3) countermeasures against noise to maintain the 10-bit resolution, the ani0 to ani15 pins must be effectively protected from noise. the influence of noise increases as the output impedance of the analog input sour ce becomes higher. to lower the noise, connecting an external capacitor as shown in figure 13-12 is recommended. figure 13-12. processing of analog input pin av ref0 v dd v ss av ss clamp with a diode with a low v f (0.3 v or less) if noise equal to or higher than av ref0 or equal to or lower than av ss may be generated. ani0 to ani15 (4) alternate i/o the analog input pins (ani0 to ani15) function alternately as port pins. when selecting one of the ani0 to ani15 pins to execute a/d conversion, do not execute an instruction to r ead an input port or write to an output port during conversion as the conversion resolution may drop. also the conversion resolution may drop at the pins set as output port pins during a/d conversion if the output current fluctuates due to the effect of the ex ternal circuit connected to the port pins. if a digital pulse is applied to a pin adjacent to t he pin whose input signal is being converted, the a/d conversion value may not be as expected due to the influence of coupling noise. therefore, do not apply a pulse to a pin adjacent to the pin undergoing a/d conversion.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 472 (5) interrupt request flag (adif) the interrupt request flag (adif) is not cleared even if the contents of the ada0s regi ster are changed. if the analog input pin is changed during a/d co nversion, therefore, the result of converting the previously selected analog input signal may be stored and the conversion end interrupt request flag may be set immediately before the ada0s register is rewritten. if the adif flag is read immediately after the ada0s register is rewritten, the adif flag may be set even though the a/d conversion of the newly selected analog input pin has not been completed. when a/d conversion is stopped, cl ear the adif flag before resuming conversion. figure 13-13. generation timing of a/d conversion end interrupt request ada0s rewriting (anin conversion start) ada0s rewriting (anim conversion start) adif is set, but anim conversion does not end a/d conversion ada0crn intad anin anin anim anim anim anin anin anim remark n = 0 to 15 m = 0 to 15 (6) internal equivalent circuit the following shows the equivalent circuit of the analog input block. figure 13-14. internal equi valent circuit of anin pin anin c in r in r in c in 2 k ? 4.9 pf remarks 1. the above values are reference values. 2. n = 0 to 15
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 473 (7) av ref0 pin (a) the av ref0 pin is used as the power supply pin of the a/d converter and also supplies power to the alternate-function ports. in an application where a backup power supply is used, be sure to supply the same voltage as v dd to the av ref0 pin as shown in figure 13-15. (b) the av ref0 pin is also used as the reference voltage pin of the a/d converter. if the source supplying power to the av ref0 pin has a high impedance or if the power supply has a low current supply capability, the reference voltage may fluctuate due to the current that flows during conversion (especially, immediately after the conversion operation enable bit ada0ce has been set to 1). as a result, the conversion accuracy may drop. to avoid this, it is recommended to connect a capacitor across the av ref0 and av ss pins to suppress the reference voltage fluctuation as shown in figure 13-15. (c) if the source supplying power to the av ref0 pin has a high dc resistance (for example, because of insertion of a diode), the voltage when conversion is enabled may be lower than the voltage when conversion is stopped, because of a voltage drop caused by the a/d conversion current. figure 13-15. av ref0 pin processing example av ref0 note av ss main power supply note parasitic inductance (8) reading ada0crn register when the ada0m0 to ada0m2 or ada0s register is wr itten, the contents of t he ada0crn register may be undefined. read the conversion result after completion of conversion and before writing to the ada0m0 to ada0m2 and ada0s registers. the correct conversion resu lt may not be read at a timing different from the above. (9) standby mode because the a/d converter stops oper ating in the stop mode, conversion results are invalid, so power consumption can be reduced. operations are resu med after the stop mode is released, but the a/d conversion results after the stop mode is released are invalid. when using the a/d converter after the stop mode is released, before setting the stop mode or rele asing the stop mode, clear the ada0m0.ada0ce bit to 0 then set the ada0ce bit to 1 after releasing the stop mode. in the idle1, idle2, or subclock operation mode, oper ation continues. to lower the power consumption, therefore, clear the ada0m0.ada0ce bit to 0. in the idle1 and idle2 modes, since the analog input voltage value cannot be retained, the a/d conversion results a fter the idle1 and idle2 modes are released are invalid. the results of conversions before the id le1 and idle2 modes were set are valid.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 474 (10) restrictions for each mode (a) to select the external trigger mode/timer trigger mode, set the high-speed conversion mode. do not input a trigger during stabilization time that is insert ed once after the a/d conversion operation is enabled (ada0m0.ada0ce bit = 1). (b) when writing data to an a/d control register in the following modes, stop the a/d conversion by clearing the ad0m0.ada0ce bit to 0. after the data is writt en to the register, enable the a/d conversion again by setting the ada0ce bit to 1 . ? normal conversion mode ? one-shot select mode/one-shot scan mode in high-speed conversion mode remark a/d control registers: ada0m0, ada0m2, ada0s, ada0pfm, and ada0pft registers (11) variation of a/d conversion results the results of the a/d conversion may vary depending on the fluctuation of the supply voltage, or may be affected by noise. to reduce the vari ation, take counteractive measures with the program such as averaging the a/d conversion results. (12) a/d conversion result hysteresis characteristics the successive comparison type a/d converter holds t he analog input voltage in the internal sample & hold capacitor and then performs a/d conversi on. after the a/d conversion ha s finished, the analog input voltage remains in the internal sample & hold capacitor. as a result, the following phenomena may occur. ? when the same channel is used for a/d conversions, if th e voltage is higher or lower than the previous a/d conversion, then hysteresis characteristics may appear where the conversion result is affected by the previous value. thus, even if t he conversion is performed at the same potential, the result may vary. ? when switching the analog input channel, hysteres is characteristics may appear where the conversion result is affected by the previous channel value. this is because one a/d converter is used for the a/d conversions. thus, even if the conversion is perfo rmed at the same potential, the result may vary.
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 475 13.7 how to read a/d converter characteristics table this section describes the terms related to the a/d converter. (1) resolution the minimum analog input voltage that c an be recognized, i.e., the ratio of an analog input voltage to 1 bit of digital output is called 1 lsb (least significant bit). the ratio of 1 lsb to the full scale is expressed as %fsr (full-scale range). %fsr is the ratio of a range of convertible analog input voltages expressed as a percentage, and can be expressed as follows, independently of the resolution. 1%fsr = (maximum value of convertible analog input voltage ? minimum value of convertible analog input voltage)/100 = (av ref0 ? 0)/100 = av ref0 /100 when the resolution is 10 bits, 1 lsb is as follows: 1 lsb = 1/2 10 = 1/1,024 = 0.098%fsr the accuracy is determined by the overall error, independently of the resolution. (2) overall error this is the maximum value of the difference between an actually measured value and a theoretical value. it is a total of zero-scale error, full-scale error, linearity error, and a combination of these errors. the overall error in the characteristics ta ble does not include the quantization error. figure 13-16. overall error ideal line overall error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 476 (3) quantization error this is an error of 1/2 lsb that inevitably occurs when an analog value is converted into a digital value. because the a/d converter converts analog input voltages in a range of 1/2 lsb into the same digital codes, a quantization error is unavoidable. this error is not included in the overall error, zero-scale error, full-scale error, integral linearity error, or differential linearity error in the characteristics table. figure 13-17. quantization error quantization error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output 1/2 lsb 1/2 lsb (4) zero-scale error this is the difference between the actually measured analog input voltage and its theoretical value when the digital output changes from 0?000 to 0?001 (1/2 lsb). figure 13-18. zero-scale error av ref0 analog input (lsb) digital output (lower 3 bits) ideal line 111 ? 10123 100 011 010 001 000 zero-scale error
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 477 (5) full-scale error this is the difference between the actually measured analog input voltage and its theoretical value when the digital output changes from 1?110 to 1?111 (full scale ? 3/2 lsb). figure 13-19. full-scale error av ref0 analog input (lsb) digital output (lower 3 bits) 111 av ref0 ? 3 0 av ref0 ? 2av ref0 ? 1 100 011 010 000 full-scale error (6) differential linearity error ideally, the width to output a specific code is 1 lsb. this error indicates the difference between the actually measured value and its theoretical value when a sp ecific code is output. this indicates the basic characteristics of the a/d conversion when the voltage applied to the analog input pins of the same channel is consistently increased bit by bit from av ss to av ref0 . when the input voltage is increased or decreased, or when two or more channels are used, see 13.7 (2) overall error . figure 13-20. differential linearity error ideal width of 1 lsb differential linearity error 1 ...... 1 0 ...... 0 av ref0 analog input digital output
chapter 13 a/d converter preliminary user's manual u17714ej1v0ud 478 (7) integral linearity error this error indicates the extent to which the conversion char acteristics differ from the ideal linear relationship. it indicates the maximum value of the difference between t he actually measured value and its theoretical value where the zero-scale error and full-scale error are 0. figure 13-21. integral linearity error 1 ...... 1 0 ...... 0 0av ref0 analog input digital output ideal line integral linearity error (8) conversion time this is the time required to obtain a digital output after each trigger has been generated. the conversion time in the characteristics table includes the sampling time. (9) sampling time this is the time for which the analog switch is on to load an analog voltage to the sample & hold circuit. figure 13-22. sampling time sampling time conversion time
preliminary user's manual u17714ej1v0ud 479 chapter 14 d/a converter 14.1 functions the d/a converter has the following functions. 8-bit resolution 2 channels (da0cs0, da0cs1) r-2r ladder method settling time: 3 s max. (when av ref1 is 3.0 to 3.6 v and external load is 20 pf) analog output voltage: av ref1 m/256 (m = 0 to 255; value set to da0csn register) operation modes: normal mo de, real-time output mode remark n = 0, 1 14.2 configuration the d/a converter configur ation is shown below. figure 14-1. block diagram of d/a converter dacs0 register selector selector dacs1 register ano0 pin ano1 pin da0m.dace0 bit da0m.dace1 bit dacs0 register write da0m.damd0 bit inttp2cc0 signal dacs1 register write da0m.damd1 bit inttp3cc0 signal av ref1 pin av ss pin cautions 1. dac0 and dac1 share the av ref1 pin. 2. dac0 and dac1 share the av ss pin. the av ss pin is also shared by the a/d converter.
chapter 14 d/a converter preliminary user's manual u17714ej1v0ud 480 the d/a converter includes the following hardware. table 14-1. configuration of d/a converter item configuration control registers d/a converter mode register (da0m) d/a conversion value setting registers 0, 1 (da0cs0, da0cs1) 14.3 registers the registers that control the d/ a converter are as follows. ? d/a converter mode register (da0m) ? d/a conversion value setting registers 0, 1 (da0cs0, da0cs1) (1) d/a converter mode register (da0m) the da0m register controls the operation of the d/a converter. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 normal mode real-time output mode note da0mdn 0 1 selection of d/a converter operation mode (n = 0, 1) da0m 0 da0ce1 da0ce0 0 0 da0md1 da0md0 after reset: 00h r/w address: fffff282h disables operation enables operation da0cen 0 1 control of d/a converter operation enable/disable (n = 0, 1) < > < > note the output trigger in the real-time outpu t mode (da0mdn bit = 1) is as follows. ? when n = 0: inttp2cc0 signal (see chapter 7 16-bit timer/event counter p (tmp) ) ? when n = 1: inttp3cc0 signal (see chapter 7 16-bit timer/event counter p (tmp) )
chapter 14 d/a converter preliminary user's manual u17714ej1v0ud 481 (2) d/a conversion value setting registers 0, 1 (da0cs0, da0cs1) the da0cs0 and da0cs1 registers set the analog volt age value output to the ano0 and ano1 pins. these registers can be read or written in 8-bit units. reset sets these registers to 00h. da0csn7 da0csn da0csn6 da0csn5 da0csn4 da0csn3 da0csn2 da0csn1 da0csn0 after reset: 00h r/w address: da0cs0 fffff280h, da0cs1 fffff281h caution in the real-time output mode (da0m.da0mdn bit = 1), set the da0csn register before the inttp2cc0/inttp3cc0 signals are generate d. d/a conversion starts when the inttp2cc0/inttp3cc0 signa ls are generated. remark n = 0, 1
chapter 14 d/a converter preliminary user's manual u17714ej1v0ud 482 14.4 operation 14.4.1 operation in normal mode d/a conversion is performed using a write operation to the da0csn register as the trigger. the setting method is described below. <1> set the da0m.da0mdn bit to 0 (normal mode). <2> set the analog voltage value to be output to the anon pin to the da0csn register. steps <1> and <2> above constitute the initial settings. <3> set the da0m.da0cen bit to 1 (d/a conversion enable). d/a conversion starts when this setting is performed. <4> to perform subsequent d/a conversions, write to the da0csn register. the previous d/a conversion result is held un til the next d/a conversion is performed. remarks 1. for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin . 2. n = 0, 1 14.4.2 operation in real-time output mode d/a conversion is performed using the interrupt reques t signals (inttp2cc0 and inttp3cc0) of tmp2 and tmp3 as triggers. the setting method is described below. <1> set the da0m.da0mdn bit to 1 (real-time output mode). <2> set the analog voltage value to be output to the anon pin to the da0csn register. <3> set the da0m.da0cen bit to 1 (d/a conversion enable). steps <1> to <3> above consti tute the initial settings. <4> operate tmp2 and tmp3. <5> d/a conversion starts when the inttp2cc0 and inttp3cc0 signals are generated. <6> after that, the value set in da0csn register is out put every time the inttp2cc0 and inttp3cc0 signals are generated. remarks 1. the output values of the ano0 and ano1 pins up to <5> above are undefined. 2. for the output values of the ano0 and ano1 pi ns in the halt, idle1, idle2, and stop modes, see chapter 21 standby function . 3. for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin .
chapter 14 d/a converter preliminary user's manual u17714ej1v0ud 483 14.4.3 cautions observe the following cautions when usi ng the d/a converter of the v850es/jj2. (1) do not change the set value of the da0csn register while the trigger signal is being issued in the real-time output mode. (2) before changing the operation mode, be sure to clear the da0m.da0cen bit to 0. (3) when using one of the p10/an00 and p11/an01 pins as an i/o port and the other as a d/a output pin, do so in an application where the port i/o level does not change during d/a output. (4) make sure that av ref0 = v dd = av ref1 = 3.0 to 3.6 v. if this range is e xceeded, the operation is not guaranteed. (5) apply power to av ref1 at the same timing as av ref0 . (6) no current can be output from the anon pin (n = 0, 1) because the output impedance of the d/a converter is high. when connecting a resistor of 2 m ? or less, insert a jfet input operational amplifier between the resistor and the anon pin. figure 14-2. external pin connection example av ref1 v dd output 10 f 0.1 f 10 f 0.1 f av ref0 anon av ss ? + jfet input operational amplifier (7) because the d/a converter stops operation in the stop mode, the ano0 and ano1 pins go into a high- impedance state, and the power consumption can be reduced. in the idle1, idle2, or subclock operation mode, however, the operation continues. to lower the power consumption, therefore, clear the da0m.da0cen bit to 0.
preliminary user's manual u17714ej1v0ud 484 chapter 15 asynchronous serial interface a (uarta) 15.1 mode switching of uarta and other serial interfaces 15.1.1 csib4 and uarta0 mode switching in the v850es/jj2, csib4 and uarta0 are alternate func tions of the same pin and therefore cannot be used simultaneously. set uarta0 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of csib4 and uarta0 is not guaranteed if these functions are switched during transmission or reception. be su re to disable the one that is not used. figure 15-1. csib4 and uarta0 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h 0 0 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 0 0 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfce3l after reset: 00h r/w address: fffff706h 0 0 0 0 0 pfce32 0 0 port i/o mode ascka0 mode sckb4 mode port i/o mode uarta0 mode csib4 mode pmc32 0 1 1 pmc3n 0 1 1 operation mode operation mode pfce32 0 0 pfc32 0 1 pfc3n 0 1 remarks 1. n = 0, 1 2. = don't care
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 485 15.1.2 uarta2 and i 2 c00 mode switching in the v850es/jj2, uarta2 and i 2 c00 are alternate functions of the same pin and therefore cannot be used simultaneously. set uarta2 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of uarta2 and i 2 c00 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 15-2. uarta2 and i 2 c00 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h pmc37 pmc36 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 pfc37 pfc36 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 port i/o mode uarta2 mode i 2 c00 mode pmc3n 0 1 1 operation mode pfc3n 0 1 remarks 1. n = 8, 9 2. = don't care
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 486 15.1.3 uarta1 and i 2 c02 mode switching in the v850es/jj2, uarta1 and i 2 c02 are alternate functions of the same pin and therefore cannot be used simultaneously. set uarta1 in advance, using the pmc9, pfc9, and pmce9 registers, before use. caution the transmit/receive operation of uarta1 and i 2 c02 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 15-3. uarta1 and i 2 c02 mode switch settings pmc9 after reset: 0000h r/w address: fffff452h, fffff453h pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 8 9 10 11 12 13 14 15 pfc9 after reset: 0000h r/w address: fffff472h, fffff473h pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 8 9 10 11 12 13 14 15 pfce915 pfce914 0 0 0 0 0 0 pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 8 9 10 11 12 13 14 15 pfce9 after reset: 0000h r/w address: fffff712h, fffff713h uarta1 mode i 2 c02 mode pmc9n 1 1 operation mode pfce9n 1 1 pfc9n 0 1 remark n = 0, 1
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 487 15.2 features transfer rate: 300 bps to 312.5 kbps (using internal system clock of 20 mhz and dedicated baud rate generator) full-duplex communication: internal uartan receive data register (uanrx) internal uartan transmit data register (uantx) 2-pin configuration: txdan: transmit data output pin rxdan: receive data input pin reception error output function ? parity error ? framing error ? overrun error interrupt sources: 2 ? reception complete interrupt (intuanr): this inte rrupt occurs upon transfer of receive data from the receive shift register to receive data register after serial transfer completion, in the reception enabled status. ? transmission enable interrupt (intuant): this interr upt occurs upon transfer of transmit data from the transmit data register to the transmit shift register in the transmission enabled status. character length: 7, 8 bits parity function: odd, even, 0, none transmission stop bit: 1, 2 bits on-chip dedicated baud rate generator msb-/lsb-first transfer selectable transmit/receive data inverted input/output possible sbf (sync break field) transmission/reception in the li n (local interconnect network) communication format possible ? 13 to 20 bits selectable for sbf transmission ? recognition of 11 bits or more possible for sbf reception ? sbf reception flag provided remark n = 0 to 3
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 488 15.3 configuration the block diagram of the uartan is shown below. figure 15-4. block diagram of asynchronous serial interface an internal bus internal bus uanotp0 uanctl0 uanstr uanctl1 uanctl2 receive shift register uanrx filter selector uantx transmit shift register transmission controller reception controller selector baud rate generator baud rate generator intuanr intuant txdan rxdan f xx to f xx /2 10 ascka0 note reception unit transmission unit clock selector note uarta0 only remarks 1. n = 0 to 3 2. for the configuration of the baud rate generator, see figure 15-16 . uartan includes the following hardware. table 15-1. configuration of uartan item configuration registers uartan control register 0 (uanctl0) uartan control register 1 (uanctl1) uartan control register 2 (uanctl2) uartan option control register 0 (uanopt0) uartan status register (uanstr) uartan receive shift register uartan receive data register (uanrx) uartan transmit shift register uartan transmit data register (uantx)
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 489 (1) uartan control register 0 (uanctl0) the uanctl0 register is an 8-bit register used to specify the uartan operation. (2) uartan control register 1 (uanctl1) the uanctl1 register is an 8-bit register used to select the input clock for the uartan. (3) uartan control register 2 (uanctl2) the uanctl2 register is an 8-bit register us ed to control the baud rate for the uartan. (4) uartan option control register 0 (uanopt0) the uanopt0 register is an 8-bit register used to control serial transfer for the uartan. (5) uartan status register (uanstr) the uanstrn register consists of fl ags indicating the error contents when a reception error occurs. each one of the reception error flags is set (to 1) upon occurrence of a reception error and is re set (to 0) by reading the uanstr register. (6) uartan receive shift register this is a shift register used to convert the serial data input to the rxdan pin into parallel data. upon reception of 1 byte of data and detection of the stop bit, the receive data is transferred to the uanrx register. this register cannot be manipulated directly. (7) uartan receive data register (uanrx) the uanrx register is an 8-bit register that holds receiv e data. when 7 characters are received, 0 is stored in the highest bit (when data is received lsb first). in the reception enabled status, receive data is transfe rred from the uartan receive shift register to the uanrx register in synchronization with the comple tion of shift-in processing of 1 frame. transfer to the uanrx register also causes the recept ion complete interrupt request signal (intuanr) to be output. (8) uartan transmit shift register the transmit shift register is a shift register used to convert the parallel data transferred from the uantx register into serial data. when 1 byte of data is transferred from the uantx register, the shift register data is output from the txdan pin. this register cannot be manipulated directly. (9) uartan transmit data register (uantx) the uantx register is an 8-bit transmit data buffer. tr ansmission starts when transmit data is written to the uantx register. when data can be wri tten to the uantx register (when dat a of one frame is transferred from the uantx register to the uartan transmit shift regi ster), the transmission enable interrupt request signal (intuant) is generated.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 490 15.4 registers (1) uartan control register 0 (uanctl0) the uanctl0 register is an 8-bit register that c ontrols the uartan serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 10h. (1/2) uanpwr disable uartan operation (uartan reset asynchronously) enable uartan operation uanpwr 0 1 uartan operation control uanctl0 (n = 0 to 3) uantxe uanrxe uandir uanps1 uanps0 uancl uansl <6> <5> <4> 3 2 1 after reset: 10h r/w address: ua0ctl0 fffffa00h, ua1ctl0 fffffa10h, ua2ctl0 fffffa20h, ua3ctl0 fffffa30h the uartan operation is controlled by the uanpwr bit. the txdan pin output is fixed to high level by clearing the uanpwr bit to 0 (fixed to low level if uanopt0.uantdl bit = 1). disable transmission operation enable transmission operation uantxe 0 1 transmission operation enable ? to start transmission, set the uanpwr bit to 1 and then set the uantxe bit to 1. to stop, transmission clear the uantxe bit to 0 and then uanpwr bit to 0. ? to initialize the transmission unit, clear the uantxe bit to 0, wait for two cycles of the base clock, and then set the uantxe bit to 1 again. otherwise, initialization may not be executed (for the base clock, see 15.7 (1) (a) base clock ). disable reception operation enable reception operation uanrxe 0 1 reception operation enable ? to start reception, set the uanpwr bit to 1 and then set the uanrxe bit to 1. to stop reception, clear the uanrxe bit to 0 and then uanpwr bit to 0. ? to initialize the reception unit, clear the uanrxe bit to 0, wait for two periods of the base clock, and then set the uanrxe bit to 1 again. otherwise, initialization may not be executed (for the base clock, see 15.7 (1) (a) base clock ). <7> 0
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 491 (2/2) 7 bits 8 bits uancl 0 1 specification of data character length of 1 frame of transmit/receive data this register can be rewritten only when the uanpwr bit = 0 or the uantxe bit = the uanrxe bit = 0. 1 bit 2 bits uansl 0 1 specification of length of stop bit for transmit data this register can be rewritten only when the uanpwr bit = 0 or the uantxe bit = the uanrxe bit = 0. ? this register is rewritten only when the uanpwr bit = 0 or the uantxe bit = the uanrxe bit = 0.  if ?reception with 0 parity? is selected during reception, a parity check is not performed. therefore, the uanstr.uanpe bit is not set.  when transmission and reception are performed in the lin format, clear the uanps1 and uanps0 bits to 00. no parity output 0 parity output odd parity output even parity output reception with no parity reception with 0 parity odd parity check even parity check uanps1 0 0 1 1 parity selection during transmission parity selection during reception uanps0 0 1 0 1 msb-first transfer lsb-first transfer uandir 0 1 transfer direction selection this register can be rewritten only when the uanpwr bit = 0 or the uantxe bit = the uanrxe bit = 0. remark for details of parity, see 15.6.9 parity types and operations .
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 492 (2) uartan control register 1 (uanctl1) for details, see 15.7 (2) uartan control register 1 (uanctl1) . (3) uartan control register 2 (uanctl2) for details, see 15.7 (3) uartan control register 2 (uanctl2) . (4) uartan option control register 0 (uanopt0) the uanopt0 register is an 8-bit regist er that controls the serial transfer operation of the uartan register. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 14h. (1/2) uansrf when the uanctl0.uanpwr bit = uanctl0.uanrxe bit = 0 are set. also upon normal end of sbf reception. during sbf reception uansrf 0 1 sbf reception flag uanopt0 (n = 0 to 3) uansrt uanstt uansls2 uansls1 uansls0 uantdl uanrdl 654321 after reset: 14h r/w address: ua0opt0 fffffa03h, ua1opt0 fffffa13h, ua2opt0 fffffa23h, ua3opt0 fffffa33h sbf reception trigger uansrt 0 1 sbf reception trigger  sbf (sync break field) reception is judged during lin communication.  the uansrf bit is held at 1 when an sbf reception error occurs, and then sbf reception is started again.  this is the sbf reception trigger bit during lin communication, and when read, ?0? is always read. for sbf reception, set the uansrt bit (to 1) to enable sbf reception.  set the uansrt bit after setting the uanpwr bit = uanrxe bit = 1.  this is the sbf transmission trigger bit during lin communication, and when read, ?0? is always read.  set the uanstt bit after setting the uanpwr bit = uantxe bit = 1. sbf transmission trigger uanstt 0 1 sbf transmission trigger <7> 0 ? ? caution do not set the uansrt and uanstt bits (to 1) during sbf reception (uansrf bit = 1).
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 493 (2/2) uansls2 1 1 1 0 0 0 0 1 uansls1 0 1 1 0 0 1 1 0 uansls0 1 0 1 0 1 0 1 0 13-bit output (reset value) 14-bit output 15-bit output 16-bit output 17-bit output 18-bit output 19-bit output 20-bit output sbf transmit length selection  the output level of the txdan pin can be inverted using the uantdl bit.  this register can be set when the uanpwr bit = 0 or when the uantxe bit = 0. this register can be set when the uanpwr bit = 0 or when the uantxe bit = 0. normal output of transfer data inverted output of transfer data uantdl 0 1 transmit data level bit  the input level of the rxdan pin can be inverted using the uanrdl bit.  this register can be set when the uanpwr bit = 0 or the uanrxe bit = 0. normal input of transfer data inverted input of transfer data uanrdl 0 1 receive data level bit (5) uartan status register (uanstr) the uanstr register is an 8-bit register that displays t he uartan transfer status and reception error contents. this register can be read or written in 8-bit or 1-bi t units, but the uantsf bit is a read-only bit, while the uanpe, uanfe, and uanove bits can both be read and written. however, these bits can only be cleared by writing 0; they cannot be set by writing 1 (even if 1 is written to them, the value is retained). the initialization conditions are shown below. register/bit initialization conditions uanstr register ? reset ? uanctl0.uanpwr = 0 uantsf bit ? uanctl0.uantxe = 0 uanpe, uanfe, uanove bits ? 0 write ? uanctl0.uanrxe = 0
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 494 uantsf  when the uanpwr bit = 0 or the uantxe bit = 0 has been set.  when, following transfer completion, there was no next data transfer from uantx register write to uantx register uantsf 0 1 transfer status flag uanstr (n = 0 to 3) 0 0 0 0 uanpe uanfe uanove 6 5 4 3 <2> <1> after reset: 00h r/w address: ua0str fffffa04h, ua1str fffffa14h, ua2str fffffa24h, ua3str fffffa34h the uantsf bit is always 1 when performing continuous transmission. when initializing the transmission unit, check that the uantsf bit = 0 before performing initialization. the transmit data is not guaranteed when initialization is performed while the uantsf bit = 1.  when the uanpwr bit = 0 or the uanrxe bit = 0 has been set.  when 0 has been written when parity of data and parity bit do not match during reception. uanpe 0 1 parity error flag  the operation of the uanpe bit is controlled by the settings of the uanctl0.uanps1 and uanctl0.uanps0 bits.  the uanpe bit can be read and written, but it can only be cleared by writing 0 to it, and it cannot be set by writing 1 to it. when 1 is written to this bit, the value is retained.  when the uanpwr bit = 0 or the uanrxe bit = 0 has been set  when 0 has been written when no stop bit is detected during reception uanfe 0 1 framing error flag  only the first bit of the receive data stop bits is checked, regardless of the value of the uanctl0.uansl bit.  the uanfe bit can be both read and written, but it can only be cleared by writing 0 to it, and it cannot be set by writing 1 to it. when 1 is written to this bit, the value is retained .  when the uanpwr bit = 0 or the uanrxe bit = 0 has been set.  when 0 has been written when receive data has been set to the uanrx register and the next receive operation is completed before that receive data has been read uanove 0 1 overrun error flag  when an overrun error occurs, the data is discarded without the next receive data being written to the receive buffer.  the uanove bit can be both read and written, but it can only be cleared by writing 0 to it. when 1 is written to this bit, the value is retained . <7> <0>
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 495 (6) uartan receive data register (uanrx) the uanrx register is an 8-bit buffer r egister that stores parallel data conver ted by the receive shift register. the data stored in the receive shift register is transfe rred to the uanrx register upon completion of reception of 1 byte of data. during lsb-first reception when the data length has been s pecified as 7 bits, the receive data is transferred to bits 6 to 0 of the uanrx register and the msb always becomes 0. during msb-first reception, the receive data is transferred to bits 7 to 1 of the uanrx register and the lsb always becomes 0. when an overrun error (uanove) occurs, the receive data at this time is not transferred to the uanrx register and is discarded. this register is read-only, in 8-bit units. in addition to reset input, the uanrx register can be set to ffh by clearing the uanctl0.uanpwr bit to 0. uanrx (n = 0 to 3) 654321 after reset: ffh r address: ua0rx fffffa06h, ua1rx fffffa16h, ua2rx fffffa26h, ua3rx fffffa36h 7 0 (7) uartan transmit data register (uantx) the uantx register is an 8-bit register used to set transmit data. this register can be read or written in 8-bit units. reset sets this register to ffh. uantx (n = 0 to 3) 654321 after reset: ffh r/w address: ua0tx fffffa07h, ua1tx fffffa17h, ua2tx fffffa27h, ua3tx fffffa37h 7 0
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 496 15.5 interrupt request signals the following two interrupt request signals are generated from uartan. ? reception complete interrupt request signal (intuanr) ? transmission enable interrupt request signal (intuant) the default priority for these two interrupt request signals is reception complete interrupt request signal then transmission enable interrupt request signal. table 15-2. interrupts and their default priorities interrupt priority reception complete high transmission enable low (1) reception complete interrupt request signal (intuanr) a reception complete interrupt request signal is output w hen data is shifted into the receive shift register and transferred to the uanrx register in the reception enabled status. when a reception complete interrupt request signal is rece ived and the data is read, read the uanstr register and check that the reception result is not an error. no reception complete interrupt request signal is generated in the reception disabled status. (2) transmission enable interr upt request signal (intuant) if transmit data is transferred from the uantx register to the uartan transmit shift register with transmission enabled, the transmission enable interrupt request signal is generated.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 497 15.6 operation 15.6.1 data format full-duplex serial data reception and transmission is performed. as shown in figure 15-5, one data frame of transmit/receive data consists of a start bit, character bits, parity bit, and stop bit(s). specification of the character bit length within 1 data frame, parity selection, s pecification of the stop bit length, and specification of msb/lsb-first transfer ar e performed using the uanctl0 register. moreover, control of uart output/inverted output for the txdan bit is performed using the uanopt0.uantdl bit. ? start bit ................. 1 bit ? character bits........ 7 bits/8 bits ? parity bit ................ even parity/odd parity/0 parity/no parity ? stop bit .................. 1 bit/2 bits
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 498 figure 15-5. uarta transmit/receive data format (a) 8-bit data length, lsb first, even parity, 1 stop bit, transfer data: 55h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit (b) 8-bit data length, msb first, even parity, 1 stop bit, transfer data: 55h 1 data frame start bit d7 d6 d5 d4 d3 d2 d1 d0 parity bit stop bit (c) 8-bit data length, msb first, even parity, 1 stop bit, transfer data: 55h, txdan inversion 1 data frame start bit d7 d6 d5 d4 d3 d2 d1 d0 parity bit stop bit (d) 7-bit data length, lsb first, odd pa rity, 2 stop bits, transfer data: 36h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 parity bit stop bit stop bit (e) 8-bit data length, lsb first, no pa rity, 1 stop bit, transfer data: 87h 1 data frame start bit d0 d1 d2 d3 d4 d5 d6 d7 stop bit
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 499 15.6.2 sbf transmission/reception format the v850es/jj2 has an sbf (sync break field) transmission/ reception control function to enable use of the lin function. remark lin stands for local interconnect network and is a low-speed (1 to 20 kbps) serial communication protocol intended to aid the cost reduction of an automotive network. lin communication is single-master communicat ion, and up to 15 slaves can be connected to one master. the lin slaves are used to contro l the switches, actuators, and sensor s, and these are connected to the lin master via the lin network. normally, the lin master is connected to a network such as can (controller area network). in addition, the lin bus uses a single-wire method and is connected to the nodes via a transceiver that complies with iso9141. in the lin protocol, the master transmits a frame wit h baud rate information and the slave receives it and corrects the baud rate error. therefore, communicat ion is possible when the baud rate error in the slave is 15% or less. figures 15-6 and 15-7 outline the transmissi on and reception manipulations of lin. figure 15-6. lin transmissi on manipulation outline lin bus wake-up signal frame sync break field sync field identifier field data field data field check sum field intuant interrupt txdan (output) note 3 8 bits note 1 note 2 13 bits sbf transmission note 4 55h transmission data transmission data transmission data transmission data transmission notes 1. the interval between each field is controlled by software. 2. sbf output is performed by har dware. the output width is the bit length set by the uanopt0.uansbl2 to uanopt0.uansbl0 bits. if even finer output width adjustments are required, such adjustments can be performed us ing the uanctln.uanbrs7 to uanctln.uanbrs0 bits. 3. 80h transfer in the 8-bit mode is substituted for the wakeup signal frame. 4. a transmission enable interrupt request signal (intua nt) is output at the star t of each transmission. the intuant signal is also output at the start of each sbf transmission.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 500 figure 15-7. lin recepti on manipulation outline reception interrupt (intuanr) edge detection capture timer disable disable enable rxdan (input) enable note 2 13 bits sbf reception note 3 note 4 note 1 sf reception id reception data transmission data transmission note 5 data transmission lin bus wake-up signal frame sync break field sync field identifier field data field data field check sum field notes 1. the wakeup signal is sent by the pin edge detec tor, uartan is enabled, and the sbf reception mode is set. 2. the receive operation is performed until detection of the stop bit. upon detection of sbf reception of 11 or more bits, normal sbf reception end is judged, and an interrupt signal is output. upon detection of sbf reception of less than 11 bits, an sbf reception error is judged, no interrupt signal is output, and the mode returns to the sbf reception mode. 3. if sbf reception ends normally, an interrupt request signal is output. the timer is enabled by an sbf reception complete interrupt. moreover, error detection for the uanstr.uanove, uanstr.uanpe, and uanstr.uanfe bits is suppressed and uart communication error detection processing and uartan receive shift register and data transfer of the uanrx register are not performed. the uartan receive shift register holds the initial value, ffh. 4. the rxdan pin is connected to ti (capture input) of the timer, the tran sfer rate is calculated, and the baud rate error is calculated. the value of the uanctl2 register obtained by correcting the baud rate error after dropping uarta enable is set again, causing the status to become the reception status. 5. check-sum field distinctions are made by softwar e. uartan is initialized following csf reception, and the processing for setting the sbf reception mode again is performed by software.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 501 15.6.3 sbf transmission when the uanctl0.uanpwr bit = uanctl0.uantxe bit = 1, the transmission enabled status is entered, and sbf transmission is started by setting (to 1) the sbf transmission trigger (uanopt0.uanstt bit). thereafter, a low level the width of bits 13 to 20 specif ied by the uanopt0.uansls2 to uanopt0.uansls0 bits is output. a transmission enable interrupt request signal (intuant) is generated upon sbf transmission start. following the end of sbf transmission, the uanstt bit is autom atically cleared. thereafter, the uart transmission mode is restored. transmission is suspended until the data to be transmitted next is written to the uantx register, or until the sbf transmission trigger (uanstt bit) is set. figure 15-8. sbf transmission intuant interrupt txdan 12345678910111213 stop bit setting of uanstt bit
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 502 15.6.4 sbf reception the reception enabled status is achieved by setting the uanctl0.uanpwr bit to 1 and then setting the uanctl0.uanrxe bit to 1. the sbf reception wait status is set by setting the sbf reception trigger (uanopt0.uanstr bit) to 1. in the sbf reception wait status, sim ilarly to the uart reception wait stat us, the rxdan pin is monitored and start bit detection is performed. following detection of the start bit, rec eption is started and the in ternal counter counts up according to the set baud rate. when a stop bit is received, if the sbf width is 11 or more bits, normal processing is judged and a reception complete interrupt request signal (intuanr) is output. the uanopt0.uansrf bit is aut omatically cleared and sbf reception ends. error detection for the uanstr.uanove, uanstr.uanpe, and uanstr.uanfe bits is suppressed and uart communication error detection processing is not performed. moreover, data transfer of the uartan reception shift register and uanrx regist er is not performed and ffh, the initial valu e, is held. if the sbf width is 10 or fewer bits, reception is terminated as error processi ng without outputting an interrupt, and the sbf reception mode is returned to. the uansrf bit is not cleared at this time. figure 15-9. sbf reception (a) normal sbf reception (detection of stop bit in more than 10.5 bits) uansrf rxdan 123456 11.5 7 8 9 10 11 intuanr interrupt (b) sbf reception error (detection of stop bit in 10.5 or fewer bits) uansrf rxdan 123456 10.5 78910 intuanr interrupt
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 503 15.6.5 uart transmission a high level is output to the txdan pin by setting the uanctl0.uanpwr bit to 1. next, the transmission enabled status is set by setting t he uanctl0.uantxe bit to 1, and transmission is started by writing transmit data to the uantx register. the st art bit, parity bit, and stop bit are automatically added. since the cts (transmit enable signal) input pin is not pr ovided in uartan, use a port to check that reception is enabled at the transmit destination. the data in the uantx register is tr ansferred to the uartan transmit shift register upon the start of the transmit operation. a transmission enable interrupt request signal (intuant) is generated upon completion of transmission of the data of the uantx register to the uartan transmit shift register , and thereafter the contents of the uartan transmit shift register are output to the txdan pin. write of the next transmit data to the uantx register is enabled after the intuant signal is generated. figure 15-10. uart transmission start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit intuant txdan remark lsb first
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 504 15.6.6 continuous transmission procedure uartan can write the next transmit data to the uantx regist er when the uartan transmit shift register starts the shift operation. the transmit timing of the uartan transmi t shift register can be judged from the transmission enable interrupt request signal (intuant). an efficient communication rate is realized by writing t he data to be transmitted next to the uantx register during transfer. caution when initializing transmis sions during the execution of contin uous transmissions, make sure that the uanstr.uantsf bit is 0, then perform the in itialization. transmit data that is initialized when the uantsf bit is 1 cannot be guaranteed. figure 15-11. continuous transmission processing flow start register settings uantx write yes yes no no occurrence of transmission interrupt? required number of writes performed? end
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 505 figure 15-12. continuous transmission operation timing (a) transmission start start data (1) data (1) txdan uantx transmission shift register intuant uantsf data (2) data (2) data (1) data (3) parity stop start data (2) parity stop start (b) transmission end start data (n ? 1) data (n ? 1) data (n ? 1) data (n) ff data (n) txdan uantx transmission shift register intuant uantsf uanpwr or uantxe bit parity stop stop start data (n) parity parity stop
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 506 15.6.7 uart reception the reception wait status is set by setting the uanctl0.uanpwr bit to 1 and then setting the uanctl0.uanrxe bit to 1. in the reception wait status, the rxdan pin is monitored and start bit detection is performed. start bit detection is performed using a two-step detection routine. first the rising edge of the rxdan pin is detected and sampling is started at the falling edge. the start bit is recognized if the rxdan pin is low level at the start bit sampling point. after a start bit has been recognized, the receive operation starts, and serial data is saved to the uart an receive shift register according to the set baud rate. when the reception complete interrupt request signal (i ntuanr) is output upon recepti on of the stop bit, the data of the uartan receive shift register is written to the uanr x register. however, if an overrun error (uanstr.uanove bit) occurs, the receive data at this time is not written to the uanrx register and is discarded. even if a parity error (uanstr.uanpe bit) or a framin g error (uanstr.uanfe bit) occurs during reception, reception continues until the recepti on position of the first stop bit, and in tuanr is output following reception completion. figure 15-13. uart reception start bit d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit intuanr rxdan uanrx cautions 1. be sure to read the uanrx register even when a reception error occurs. if the uanrx register is not read, an overrun error occurs during r eception of the next data, and reception errors continue occurring indefinitely. 2. the operation during recepti on is performed assuming that th ere is only one stop bit. a second stop bit is ignored. 3. when reception is completed, read the uanrx register after the reception complete interrupt request signal (intuanr) has been generated, a nd clear the uanpwr or uanrxe bit to 0. if the uanpwr or uanrxe bit is cleared to 0 befo re the intuanr signal is generated, the read value of the uanrx register cannot be guaranteed. 4. if receive completion processing (intuanr signal generation) of uartan and the uanpwr bit = 0 or uanrxe bit = 0 conflict, the intuan r signal may be generated in spite of these being no data stored in the uanrx register. to complete reception without waiting intuanr signal generati on, be sure to clear (0) the interrupt request flag (uanrif) of the uanric register, after se tting (1) the interrupt mask flag (uanrmk) of the interrupt control register (uan ric) and then set (1) the uanpwr bit = 0 or uanrxe bit = 0.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 507 15.6.8 reception errors errors during a receive operation are of three types: parity errors, framing errors, and overrun errors. data reception result error flags are set in the uanstr regi ster and a reception complete interrupt request signal (intuanr) is output when an error occurs. it is possible to ascertain which error occurred during reception by reading the contents of the uanstr register. clear the reception error flag by writing 0 to it after reading it. ? receive data read flow start no intuanr signal generated? error occurs? end yes no yes error processing read uanrx register read uanstr register caution when an intuanr signal is generated, the ua nstr register must be read to check for errors. ? reception error causes error flag reception error cause uanpe parity error received parity bit does not match the setting uanfe framing error stop bit not detected uanove overrun error reception of next data completed before data was read from receive buffer
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 508 when reception errors occur, perform the followin g procedures depending upon the kind of error. ? parity error if false data is received due to problems such as noi se in the reception line, discard the received data and retransmit. ? framing error a baud rate error may have occurred between the recept ion side and transmission side or the start bit may have been erroneously detected. since this is a fatal error for the communication format, check the operation stop in the transmission side, perform initialization processing each other, and then start the communication again. ? overrun error since the next reception is completed before reading receiv e data, 1 frame of data is discarded. if this data was needed, do a retransmission. caution if a receive error interrupt occurs during cont inuous reception, read the contents of the uanstr register must be read before the next recepti on is completed, then pe rform error processing.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 509 15.6.9 parity types and operations caution when using the lin function, fix the uanps1 a nd uanps0 bits of the uanctl0 register to 00. the parity bit is used to detect bit errors in the comm unication data. normally the same parity is used on the transmission side and the reception side. in the case of even parity and odd parity, it is possible to detect odd-count bit errors. in the case of 0 parity and no parity, errors cannot be detected. (a) even parity (i) during transmission the number of bits whose value is "1" among the trans mit data, including the parity bit, is controlled so as to be an even number. the parity bit values are as follows. ? odd number of bits whose value is "1" among transmit data: 1 ? even number of bits whose value is "1" among transmit data: 0 (ii) during reception the number of bits whose value is "1" among the rec eption data, including the par ity bit, is counted, and if it is an odd number, a parity error is output. (b) odd parity (i) during transmission opposite to even parity, the number of bits whose va lue is "1" among the transmit data, including the parity bit, is controlled so that it is an odd number . the parity bit values are as follows. ? odd number of bits whose value is "1" among transmit data: 0 ? even number of bits whose value is "1" among transmit data: 1 (ii) during reception the number of bits whose value is "1" among the rece ive data, including the parity bit, is counted, and if it is an even number, a parity error is output. (c) 0 parity during transmission, the parity bit is always made 0, regardless of the transmit data. during reception, parity bit check is not performed. therefore, no parity e rror occurs, regardless of whether the parity bit is 0 or 1. (d) no parity no parity bit is added to the transmit data. reception is performed assuming that ther e is no parity bit. no parity error occurs since there is no parity bit.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 510 15.6.10 receive data noise filter this filter samples the rxdan pin using the base clock of the prescaler output. when the same sampling value is read twice, the match det ector output changes and the rxdan signal is sampled as the input data. therefore, data not exceeding 2 clock width is judged to be noise and is not delivered to the internal circuit (see figure 15-15 ). see 15.7 (1) (a) base clock regarding the base clock. moreover, since the circuit is as shown in figure 15-14, the processing that goes on wit hin the receive operation is delayed by 3 clocks in relation to the external signal status. figure 15-14. noise filter circuit match detector in base clock (f uclk ) rxdan qin ld_en q internal signal c internal signal b in q internal signal a figure 15-15. timing of rxdan signal judged as noise internal signal b base clock rxdan (input) internal signal c mismatch (judged as noise) internal signal a mismatch (judged as noise) match match
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 511 15.7 dedicated baud rate generator the dedicated baud rate generator consists of a source clock selector block and an 8-bit programmable counter, and generates a serial clock during transmission and reception with uartan. regarding the serial clock, a dedicated baud rate generator output can be selected for each channel. there is an 8-bit counter for transmission and another one for reception. (1) baud rate generator configuration figure 15-16. configuration of baud rate generator f uclk selector uanpwr 8-bit counter match detector baud rate uanctl2: uanbrs7 to uanbrs0 1/2 uanpwr, uantxen bits (or uanrxe bit) uanctl1: uancks3 to uancks0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1024 ascka0 note note only uarta0 is valid; setting uart a1 to uarta3 is prohibited. remarks 1. n = 0 to 3 2. f xx : main clock frequency f uclk : base clock frequency (a) base clock when the uanctl0.uanpwr bit is 1, the cl ock selected by the uanctl1.uancks3 to uanctl1.uancks0 bits is supplied to the 8-bit counter. this clock is called the base clock (f uclk ). (b) serial clock generation a serial clock can be generated by setting the uanctl1 register and the uanctl2 register (n = 0 to 3). the base clock is selected by uanctl1. uancks3 to uanctl1.uancks0 bits. the frequency division value for the 8-bit count er can be set using the uanctl2.uanbrs7 to uanctl2.uanbrs0 bits.
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 512 (2) uartan control register 1 (uanctl1) the uanctl1 register is an 8-bit register that selects the uartan base clock. this register can be read or written in 8-bit units. reset sets this register to 00h. caution clear the uanctl0.uanpwr bit to 0 before rewriting the uanctl1 register. 0 uanctl1 (n = 0 to 3) 0 0 0 uancks3 uancks2 uancks1 uancks0 654321 after reset: 00h r/w address: ua0ctl1 fffffa01h, ua1ctl1 fffffa11h, ua2ctl1 fffffa21h, ua3ctl1 fffffa31h 7 0 f xx f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1,024 external clock note (ascka0 pin) setting prohibited uancks2 0 0 0 0 1 1 1 1 0 0 0 0 uancks3 0 0 0 0 0 0 0 0 1 1 1 1 base clock (f uclk ) selection uancks1 0 0 1 1 0 0 1 1 0 0 1 1 uancks0 0 1 0 1 0 1 0 1 0 1 0 1 other than above note only uarta0 is valid; setting uart a1 to uarta3 is prohibited. remark f xx : main clock frequency
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 513 (3) uartan control register 2 (uanctl2) the uanctl2 register is an 8-bit register that selects the baud rate (serial transfer speed) clock of uartan. this register can be read or written in 8-bit units. reset sets this register to ffh. caution clear the uanctl0.uanpwr bit to 0 or clear the uantxe and uanrxe bits to 00 before rewriting the uanctl2 register. uanbrs7 uanctl2 (n = 0 to 3) uanbrs6 uanbrs5 uanbrs4 uanbrs3 uanbrs2 uanbrs1 uanbrs0 654321 after reset ffh r/w address: ua0ctl2 fffffa02h, ua1ctl2 fffffa12h, ua2ctl2 fffffa22h, ua3ctl2 fffffa32h 7 0 uan brs7 0 0 0 0 : 1 1 1 1 uan brs6 0 0 0 0 : 1 1 1 1 uan brs5 0 0 0 0 : 1 1 1 1 uan brs4 0 0 0 0 : 1 1 1 1 uan brs3 0 0 0 0 : 1 1 1 1 uan brs2 0 1 1 1 : 1 1 1 1 uan brs1 0 0 1 : 0 0 1 1 uan brs0 0 1 0 : 0 1 0 1 default (k) 4 5 6 : 252 253 254 255 serial clock f uclk /4 f uclk /5 f uclk /6 : f uclk /252 f uclk /253 f uclk /254 f uclk /255 setting prohibited remark f uclk : clock frequency selected by the uanctl1.uancks3 to uanctl1.uancks0 bits
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 514 (4) baud rate the baud rate is obtained by the following equation. baud rate = [bps] when using the internal clock, the equation will be as follows (when using the ascka0 pin as clock at uarta0, calculate using the above equation). baud rate = [bps] remark f uclk = frequency of base clock selected by the uanctl1.uancks3 to uanctl1.uancks0 bits f xx : main clock frequency m = value set using the uanctl1.uancks3 to uanctl1.uancks0 bits (m = 0 to 10) k = value set using the uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (k = 4 to 255) the baud rate error is obtained by the following equation. error (%) = ? 1 100 [%] = ? 1 100 [%] when using the internal clock, the equation will be as follows (when using the ascka0 pin as clock at uarta0, calculate the baud rate error using the above equation). error (%) = ? 1 100 [%] cautions 1. the baud rate erro r during transmission must be wit hin the error tolerance on the receiving side. 2. the baud rate error during reception must satisfy the range indicated in (5) allowable baud rate range dur ing reception. f uclk 2 k actual baud rate (baud rate with error) target baud rate (correct baud rate) f xx 2 m+1 k f uclk 2 k target baud rate f xx 2 m+1 k target baud rate
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 515 to set the baud rate, perform the following calculatio n for setting the uanctl1 and uanctl2 registers (when using internal clock). <1> set k to fxx/(2 target baud rate) and m to 0. <2> if k is 256 or greater (k 256), reduce k to half (k/2) and increment m by 1 (m + 1). <3> repeat step <2> until k becomes less than 256 (k < 256). <4> round off the first decimal point of k to the nearest whole number. if k becomes 256 after round-off, perform step <2> again to set k to 128. <5> set the value of m to uanctl1 register and the value of k to the uanctl2 register. example: when f xx = 20 mhz and target baud rate = 153,600 bps <1> k = 20,000,000/(2 153,600) = 65.10?, m = 0 <2>, <3> k = 65.10? < 256, m = 0 <4> set value of uanctl2 register: k = 65 = 41h, set value of uanctl1 register: m = 0 actual baud rate = 20,000,000/(2 65) = 153,846 [bps] baud rate error = {20,000,000/(2 65 153,600) ? 1} 100 = 0.160 [%] the representative examples of baud rate settings are shown below. table 15-3. baud rate generator setting data baud rate f xx = 20 mhz f xx = 18.874 mhz f xx = 16 mhz f xx = 10 mhz (bps) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) uanctl1 uanctl2 err (%) 300 08h 82h 0.16 07h f6h ? 0.10 07h d0h 0.16 07h 82h 0.16 600 07h 82h 0.16 06h f6h ? 0.10 06h d0h 0.16 06h 82h 0.16 1,200 06h 82h 0.16 05h f6h ? 0.10 05h d0h 0.16 05h 82h 0.16 2,400 05h 82h 0.16 04h f6h ? 0.10 04h d0h 0.16 04h 82h 0.16 4,800 04h 82h 0.16 03h f6h ? 0.10 03h d0h 0.16 03h 82h 0.16 9,600 03h 82h 0.16 02h f6h ? 0.10 02h d0h 0.16 02h 82h 0.16 19,200 02h 82h 0.16 01h f6h ? 0.10 01h d0h 0.16 01h 82h 0.16 31,250 01h a0h 0 01h 97h ? 0.01 01h 80h 0 00h a0h 0 38,400 01h 82h 0.16 00h f6h ? 0.10 00h d0h 0.16 00h 82h 0.16 76,800 00h 82h 0.16 00h 7bh ? 0.10 00h 68h 0.16 00h 41h 0.16 153,600 00h 41h 0.16 00h 3dh 0.72 00h 34h 0.16 00h 21h ? 1.36 312,500 00h 20h 0 00h 1eh 0.66 00h 1ah ? 1.54 00h 10h 0 remark f xx : main clock frequency err: baud rate error (%)
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 516 (5) allowable baud rate range during reception the baud rate error range at the destination that is allowable during reception is shown below. caution the baud rate error during reception must be set within the allowable error range using the following equation. figure 15-17. allowable baud rate range during reception fl 1 data frame (11 fl) flmin flmax uartan transfer rate start bit bit 0 bit 1 bit 7 parity bit minimum allowable transfer rate maximum allowable transfer rate stop bit start bit bit 0 bit 1 bit 7 parity bit latch timing stop bit start bit bit 0 bit 1 bit 7 parity bit stop bit remark n = 0 to 3 as shown in figure 15-17, the receive data latch timing is determined by the counter set using the uanctl2 register following start bit detection. the transmit data can be normally received if up to the last data (stop bit) can be received in time for this latch timing. when this is applied to 11-bit reception, t he following is the theoretical result. fl = (brate) ? 1 brate: uartan baud rate (n = 0 to 3) k: setting value of uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (n = 0 to 3) fl: 1-bit data length latch timing margin: 2 clocks minimum allowable transfer rate: flmin = 11 fl ? fl = fl k ? 2 2k 21k + 2 2k
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 517 therefore, the maximum baud rate that can be re ceived by the destination is as follows. brmax = (flmin/11) ? 1 = brate similarly, obtaining the following maximum allowable transfer rate yields the following. flmax = 11 fl ? fl = fl flmax = fl 11 therefore, the minimum baud rate that can be received by the destination is as follows. brmin = (flmax/11) ? 1 = brate obtaining the allowable baud rate error for uartan and the destination from the above-described equations for obtaining the minimum and maximum baud rate values yields the following. table 15-4. maximum/minimum allowable baud rate error division ratio (k) maximum allowable baud rate error minimum allowable baud rate error 4 +2.32% ? 2.43% 8 +3.52% ? 3.61% 20 +4.26% ? 4.30% 50 +4.56% ? 4.58% 100 +4.66% ? 4.67% 255 +4.72% ? 4.72% remarks 1. the reception accuracy depends on the bit count in 1 frame, the input clock frequency, and the division ratio (k). the higher the input clock frequency and the larger the division ratio (k), the higher the accuracy. 2. k: setting value of uanctl2.uanbrs7 to uanctl2.uanbrs0 bits (n = 0 to 3) 10 11 k + 2 2 k 21k ? 2 2 k 21k ? 2 20 k 22k 21k + 2 20k 21k ? 2
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 518 (6) baud rate during cont inuous transmission during continuous transmission, the transfer rate from the stop bit to the next start bit is usually 2 base clocks longer. however, timing initialization is performed via st art bit detection by the receiving side, so this has no influence on the transfer result. figure 15-18. transfer rate during continuous transfer start bit bit 0 bit 1 bit 7 parity bit stop bit fl 1 data frame fl fl fl fl fl fl flstp start bit of 2nd byte start bit bit 0 assuming 1 bit data length: fl; stop bit length: flstp; and base clock frequency: f uclk , we obtain the following equation. flstp = fl + 2/f uclk therefore, the transfer rate during continuous transmission is as follows. transfer rate = 11 fl + (2/f uclk )
chapter 15 asynchronous serial interface a (uarta) preliminary user's manual u17714ej1v0ud 519 15.8 cautions (1) when the clock supply to uartan is stopped (for exam ple, in idle1, idle2, or stop mode), the operation stops with each register retaining the value it had i mmediately before the clock supply was stopped. the txdan pin output also holds and outputs the value it had immediately before the clock supply was stopped. however, the operation is not guarant eed after the clock supply is resumed. therefore, after the clock supply is resumed, the circuits should be initialized by setting the uanctl0.uanpwr, uanctl0.uanrxen, and uanctl0.uantxen bits to 000. (2) the rxda1 and kr7 pins must not be used at the same ti me. to use the rxda1 pin, do not use the kr7 pin. to use the kr7 pin, do not use the rxda1 pin (it is recommended to set the pfc91 bit to 1 and clear pfce91 bit to 0). (3) in uartan, the interrupt caused by a communication error does not occur. when performing the transfer of transmit data and receive data using dma transfer, error processing cannot be performed even if errors (parity, overrun, framing) occur during transfer. either read the uanstr register after dma transfer has been completed to make sure that there are no errors, or read the uanstr register during communication to check for errors. (4) start up the uartan in the following sequence. <1> set the uanctl0.uanpwr bit to 1. <2> set the ports. <3> set the uanctl0.uantxe bit to 1, uanctl0.uanrxe bit to 1. (5) stop the uartan in the following sequence. <1> set the uanctl0.uantxe bit to 0, uanctl0.uanrxe bit to 0. <2> set the ports and set the uanctl0.uanpwr bit to 0 (it is not a problem if port setting is not changed). (6) in transmit mode (uanctl0.uanpwr bit = 1 and uanctl0.uantxe bit = 1), do not overwrite the same value to the uantx register by software because transmission starts by writing to this register. to transmit the same value continuously, overwrite the same value. (7) in continuous transmission, the communication rate from the stop bit to the next start bit is extended 2 base clocks more than usual. however, the reception side init ializes the timing by detecting the start bit, so the reception result is not affected.
preliminary user's manual u17714ej1v0ud 520 chapter 16 3-wire variable-length serial i/o (csib) 16.1 mode switching of csib and other serial interfaces 16.1.1 csib4 and uarta0 mode switching in the v850es/jj2, csib4 and uarta0 are alternate func tions of the same pin and therefore cannot be used simultaneously. set csib4, in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of csib4 and uarta0 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 16-1. csib4 and uarta0 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h 0 0 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 0 0 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 pfce3l after reset: 00h r/w address: fffff706h 0 0 0 0 0 pfce32 0 0 port i/o mode ascka0 mode sckb4 mode port i/o mode uarta0 mode csib4 mode pmc32 0 1 1 pmc3n 0 1 1 operation mode operation mode pfce32 0 0 pfc32 0 1 pfc3n 0 1 remarks 1. n = 0, 1 2. = don't care
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 521 16.1.2 csib0 and i 2 c01 mode switching in the v850es/jj2, csib0 and i 2 c01 are alternate functions of the sa me pin and therefore cannot be used simultaneously. set csib0 in advance, using the pmc4 and pfc4 registers, before use. caution the transmit/receive operation of csib0 and i 2 c01 is not guaranteed if these functions are switched during transmission or reception. be su re to disable the one that is not used. figure 16-2. csib0 and i 2 c01 mode switch settings port i/o mode csib0 mode i 2 c01 mode pmc4n 0 1 1 operation mode pfc4n 0 1 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 after reset: 00h r/w address: fffff448h pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 remarks 1. n = 0, 1 2. = don't care 16.2 features transfer rate: 8 mbps to 4.9 kbps (f xx = 20 mhz, using internal clock) master mode and slave mode selectable 8-bit to 16-bit transfer, 3-wire serial interface interrupt request signals (intcbnt, intcbnr) 2 serial clock and data phase switchable transfer data length selectable in 1-bit units between 8 and 16 bits transfer data msb-first/lsb-first switchable 3-wire transfer sobn: serial data output sibn: serial data input sckbn: serial clock i/o transmission mode, reception mode, and transmission/reception mode specifiable remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 522 16.3 configuration the following shows the block diagram of csibn. figure 16-3. block diagram of csibn internal bus cbnctl2 cbnctl0 cbnstr controller intcbnr sobn intcbnt cbntx so latch phase control shift register cbnrx cbnctl1 phase control sibn f brgm f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 sckbn selector remarks n = 0 to 5 m = 1 (n = 0, 1) m = 2 (n = 2, 3) m = 3 (n = 4, 5) csibn includes the following hardware. table 16-1. configuration of csibn item configuration registers csibn receive data register (cbnrx) csibn transmit data register (cbntx) control registers csibn control register 0 (cbnctl0) csibn control register 1 (cbnctl1) csibn control register 2 (cbnctl2) csibn status register (cbnstr)
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 523 (1) csibn receive data register (cbnrx) the cbnrx register is a 16-bit buffer register that holds receive data. this register is read-only, in 16-bit units. the receive operation is started by reading the cbnrx register in the reception enabled status. if the transfer data length is 8 bits, the lower 8 bits of th is register are read-only in 8-bit units as the cbnrxl register. reset sets this register to 0000h. in addition to reset input, the cbnrx register can be in itialized by clearing (to 0) the cbnpwr bit of the cbnctl0 register. after reset: 0000h r address: cb0rx fffffd04h, cb1rx fffffd14h, cb2rx fffffd24h, cb3rx fffffd34h, cb4rx fffffd44h, cb5rx fffffd54h cbnrx (n = 0 to 5) (2) csibn transmit data register (cbntx) the cbntx register is a 16-bit buffer regist er used to write the csibn transfer data. this register can be read or written in 16-bit units. the transmit operation is started by writing data to t he cbntx register in the transmission enabled status. if the transfer data length is 8 bits, the lower 8 bits of th is register are read-only in 8-bit units as the cbntxl register. reset sets this register to 0000h. after reset 0000h r/w address: cb0tx fffffd06h, cb1tx fffffd16h, cb2tx fffffd26h, cb3tx fffffd36h, cb4tx fffffd46h, cb5tx fffffd56h cbntx (n = 0 to 5) remark the communication start conditions are shown below. transmission mode (cbntxe bit = 1, cbnrxe bit = 0): write to cbntx register transmission/reception mode (cbntxe bit = 1, cb nrxe bit = 1): write to cbntx register reception mode (cbntxe bit = 0, cbnrxe bit = 1): read from cbnrx register
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 524 16.4 registers the following registers are used to control csibn. ? csibn control register 0 (cbnctl0) ? csibn control register 1 (cbnctl1) ? csibn control register 2 (cbnctl2) ? csibn status register (cbnstr) (1) csibn control register 0 (cbnctl0) cbnctl0 is a register that controls the csibn serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 01h. (1/3) cbnpwr disable csibn operation and reset the cbnstr register enable csibn operation cbnpwr 0 1 specification of csibn operation disable/enable cbnctl0 (n = 0 to 5) cbntxe note cbnrxe note cbndir note 00 cbntms note cbnsce after reset: 01h r/w address: cb0ctl0 fffffd00h, cb1ctl0 fffffd10h, cb2ctl0 fffffd20h, cb3ctl0 fffffd30h, cb4ctl0 fffffd40h, cb5ctl0 fffffd50h ? the cbnpwr bit controls the csibn operation and resets the internal circuit. disable transmit operation enable transmit operation cbntxe note 0 1 specification of transmit operation disable/enable  the sobn output is low level when the cbntxe bit is 0.  when the cbnrxe bit is cleared to 0, no reception complete interrupt is output even when the prescribed data is transferred in order to disable the receive operation, and the receive data (cbnrx register) is not updated. disable receive operation enable receive operation cbnrxe note 0 1 specification of receive operation disable/enable < > < > < > < > < > note these bits can only be rewritten when the cbnpwr bit = 0. however, cbnpwr bit = 1 can also be set at the same time as rewriting these bits. caution to forcibly suspend tran smission/reception, clear the cbnpwr bit instead of the cbnrxe bit to 0. at this time, the clock output is stopped.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 525 (2/3) single transfer mode continuous transfer mode cbntms note 0 1 transfer mode specification [in single transfer mode] the reception complete interrupt request signal (intcbnr) is generated. even if transmission is enabled (cbntxe bit = 1), the transmission enable interrupt request signal (intcbnt) is not generated. if the next transmit data is written during communication (cbnstr.cbntsf bit = 1), it is ignored and the next communication is not started. also, if reception-only communication is set (cbntxe bit = 0, cbnrxe bit = 1), the next communication is not started even if the receive data is read during communication (cbnstr. cbbtsf bit = 1). [in continuous transfer mode] the continuous transmission is enabled by writing the next transmit data during communication (cbnstr.cbntsf bit = 1). writing the next transmission data is enabled after a transmission enable interrupt (intcbnt) occurrence. if reception-only communication is set (cbntxe bit = 0, cbnrxe bit = 1) in the continuous transfer mode, the next reception is started continuously after a reception complete interrupt (intcbnr) regardless of the read operation of the cbnrx register. therefore, read immediately the receive data from the cbnrx register. if this read operation is delayed, an overrun error (cbnove bit = 1) occurs. cbndir note 0 1 specification of transfer direction mode (msb/lsb) msb-first transfer lsb-first transfer note these bits can only be rewritten when the cbnpwr bit = 0. however, cbnpwr bit = 1 can also be set at the same time as rewriting these bits.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 526 (3/3) communication start trigger invalid communication start trigger valid cbnsce 0 1 specification of start transfer disable/enable ? in master mode this bit enables or disables the communication start trigger. (a) in single transmission or transmission/reception mode, or continuous transmission or continuous transmission/reception mode the setting of the cbnsce bit has no influence on communication operation. (b) in single reception mode clear the cbnsce bit to 0 before reading the last receive data because reception is started by reading the receive data (cbnrx register) to disable the reception startup note 1 . (c) in continuous reception mode clear the cbnsce bit to 0 one communication clock before reception of the last data is completed to disable the reception startup after the last data is received note 2 .  in slave mode this bit enables or disables the communication start trigger. set the cbnsce bit to 1. [usage of cbnsce bit]  in single reception mode <1>when reception of the last data is completed by intcbnr interrupt servicing, clear the cbnsce bit to 0 before reading the cbnrx register. <2>after confirming the cbnstr.cbntsf bit = 0, clear the cbnrxe bit to 0 to disable reception. to continue reception, set the cbnsce bit to 1 to start up the next reception by dummy-reading the cbnrx register.  in continuous reception mode <1>clear the cbnsce bit to 0 during the reception of the last data by intcbnr interrupt servicing. <2>read the cbnrx register. <3>read the last reception data by reading the cbnrx register after acknowledging the cbntir interrupt. <4>after confirming the cbnstr.cbntsf bit = 0, clear the cbnrxe bit to 0 to disable reception. to continue reception, set the cbnsce bit to 1 to wait for the next reception by dummy-reading the cbnrx register. notes 1. if the cbnsce bit is read while it is 1, the next communication operation is started. 2. the cbnsce bit is not cleared to 0 one communication clock before the completion of the last data reception, the next communication op eration is automatically started. caution be sure to clear bits 3 and 2 to ?0?.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 527 (2) csibn control register 1 (cbnctl1) cbnctl1 is an 8-bit register that controls the csibn serial transfer operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. caution the cbnctl1 register can be rewritte n only when the cbnc tl0.cbnpwr bit = 0. 0 cbnckp 0 0 1 1 specification of data transmission/ reception timing in relation to sckbn cbnctl1 (n = 0 to 5) 0 cbndap 0 1 0 1 0 cbnckp cbndap cbncks2 cbncks1 cbncks0 after reset 00h r/w address: cb0ctl1 fffffd01h, cb1ctl1 fffffd11h, cb2ctl1 fffffd21h, cb3ctl1 fffffd31h, cb4ctl1 fffffd41h, cb5ctl1 fffffd51h cbncks2 0 0 0 0 1 1 1 1 cbncks1 0 0 1 1 0 0 1 1 cbncks0 0 1 0 1 0 1 0 1 communication clock f xx /2 f xx /4 f xx /8 f xx /16 f xx /32 f xx /64 f brgm external clock (sckbn) master mode master mode master mode master mode master mode master mode master mode slave mode mode d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) d7 d6 d5 d4 d3 d2 d1 d0 sckbn (i/o) sibn capture sobn (output) communication type 1 communication type 2 communication type 3 communication type 4 remark when n = 0, 1, m = 1 when n = 2, 3, m = 2 when n = 4, 5, m = 3 for details of f brgm , see 16.8 baud rate generator .
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 528 (3) csibn control register 2 (cbnctl2) cbnctl2 is an 8-bit register that controls the number of csibn serial transfer bits. this register can be read or written in 8-bit units. reset sets this register to 00h. caution the cbnctl2 register can be rewritten only when the cbnctl0.cbnpwr bit = 0 or when both the cbntxe and cbnrxe bits = 0. after reset: 00h r/w address: cb0ctl2 fffffd02h, cb1ctl2 fffffd12h, cb2ctl2 fffffd22h, cb3ctl2 fffffd32h, cb4ctl2 fffffd42h, cb5ctl2 fffffd52h 0 cbnctl2 (n = 0 to 5) 0 0 0 cbncl3 cbncl2 cbncl1 cbncl0 8 bits 9 bits 10 bits 11 bits 12 bits 13 bits 14 bits 15 bits 16 bits cbncl3 0 0 0 0 0 0 0 0 1 cbncl2 0 0 0 0 1 1 1 1 cbncl1 0 0 1 1 0 0 1 1 cbncl0 0 1 0 1 0 1 0 1 serial register bit length remarks 1. if the number of transfer bits is other than 8 or 16, prepare and use data stuffed from the lsb of the cbntx and cbnrx registers. 2. : don't care
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 529 (a) transfer data length change function the csibn transfer data length can be set in 1-bit units between 8 and 16 bits using the cbnctl2.cbncl3 to cbnctl2.cbncl0 bits. when the transfer bit length is set to a value othe r than 16 bits, set the data to the cbntx or cbnrx register starting from the lsb, regardless of whether t he transfer start bit is the msb or lsb. any data can be set for the higher bits that are not used, but the receive data becomes 0 following serial transfer. (i) transfer bit length = 10 bits, msb first 15 10 9 0 sobn sibn insertion of 0 (ii) transfer bit length = 12 bits, lsb first 0 sobn 11 12 15 sibn insertion of 0
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 530 (4) csibn status register (cbnstr) cbnstr is an 8-bit register t hat displays the csibn status. this register can be read or written in 8-bit or 1-bit units, but the cbntsf flag is read-only. reset sets this register to 00h. in addition to reset input, the cbnstr register can be initialized by clearing (0) the cbnctl0.cbnpwr bit. cbntsf communication stopped communicating cbntsf 0 1 communication status flag cbnstr (n = 0 to 5) 00 0 00 0 cbnove after reset 00h r/w address: cb0str fffffd03h, cb1str fffffd13h, cb2str fffffd23h, cb3str fffffd33h, cb4str fffffd43h, cb5str fffffd53h  during transmission, this register is set when data is prepared in the cbntx register, and during reception, it is set when a dummy read of the cbnrx register is performed. when transfer ends, this flag is cleared to 0 at the last edge of the clock. no overrun overrun cbnove 0 1 overrun error flag  an overrun error occurs when the next reception starts without reading the value of the receive buffer by cpu, upon completion of the receive operation. the cbnove flag displays the overrun error occurrence status in this case.  the cbnove bit is valid also in the single transfer mode. therefore, when only using transmission, note the following.  do not check the cbnove flag.  read this bit even if reading the reception data is not required.  the cbnove flag is cleared by writing 0 to it. it cannot be set even by writing 1 to it. < > < >
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 531 16.5 operation 16.5.1 single transfer mode (master mode, transmission/reception mode) this section shows a case of msb first (cbn ctl0.cbndir bit = 0), communication type 1 (see 16.4 (2) csibn control register 1 (cbnctl1) ), and transfer data length = 8 bits (cbnctl2. cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). cbntx write (55h) cbnrx read (aah) (aah) (55h) 1 0 1 1 0 1 abh 56h adh 5ah b5h 6ah d5h aah 55h (transmit data) sckbn pin cbntx register aah 00h cbnrx register shift register intcbnr signal note sibn pin sobn pin 0 0 0 1 0 0 1 0 1 1 cbntsf bit cbnsce bit (1) (5) (6) (8) (7) (2) (3) (4) (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbntxe, cbnrxe, and cbnsce bits of t he cbnctl0 register to 1 at the same time as specifying the transfer mode using the cbndir bi t, to set the transmission/reception enabled status. (4) set the cbnpwr bit to 1 to enable the csibn operation. (5) write transfer data to the cbntx register (transmission start). (6) the reception complete interrupt request signal (intcbnr) is output. (7) read the cbnrx register before clearing the cbnpwr bit to 0. (8) check that the cbnstr.cbntsf bit = 0 and set the cbnpwr bit to 0 to stop operation of csibn (end of transmission/reception). note in single transmission or single transmission/reception mode, the intcbnt signal is not generated. when communication is complete, the intcbnr signal is generated. remark the processing of steps (3) and (4) can be set simultaneously.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 532 16.5.2 single transfer mode (master mode, reception mode) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 1 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (aah) 1 0 1 1 00 1 01h 02h 05h 0ah 15h 2ah 55h aah 00h sckbn pin cbnrx register cbnrx read (dummy read) shift register cbnsce bit cbntsf bit intcbnr signal sibn pin sobn pin 0 l (1) (2) (3) (4) (5) (6) (7) (9) (8) cbnrx read (aah) aah 00h (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbnctl0.cbnrxe and cbnctl0.cbnsce bits to 1 at the same time as specifying the transfer mode using the cbndir bit, to set the reception enabled status. (4) set the cbnpwr bit to 1 to enable the csibn operation. (5) perform a dummy read of the cbnrx register (reception start trigger). (6) the reception complete interrupt request signal (intcbnr) is output. (7) set the cbnsce bit to 0 to set the final receive data status. (8) read the cbnrx register. (9) check that the cbnstr.cbntsf bit = 0 and set the cbnpwr bit to 0 to stop the csibn operation (end of reception). remark the processing of steps (3) and (4) can be set simultaneously.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 533 16.5.3 continuous mode (master m ode, transmission/reception mode) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 3 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (8) (7) (7) (6) (5) (1) (2) (3) (4) 96h 00h cch 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 55h cbntx register sckbn pin sobn pin sibn pin intcbnt signal intcbnr signal cbntsf bit cbnsce bit shift register so latch cbnrx register 0 0 0 0 aah 96h cch 1 1 1 0 0 0 1 01 0 0 (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbntxe, cbnrxe, and cbnsce bits of t he cbnctl0 register to 1 at the same time as specifying the transfer mode using the cbndir bi t, to set the transmission/reception enabled status. (4) set the cbnpwr bit to 1 to enable the csibn operation. (5) write transfer data to the cbntx register (transmission start). (6) the transmission enable interrupt request signal (int cbnt) is received and transfer data is written to the cbntx register. (7) the reception complete interrupt request signal (intcbnr) is output. read the cbnrx register before the next receive data arrives or before the cbnpwr bit is cleared to 0. (8) check that the cbnstr.cbntsf bit = 0 and set t he cbnpwr bit to 0 to stop the operation of csibn (end of transmission/reception). to continue transfer, repeat steps (5) to (7) before (8). in transmission mode or transmission/reception mode , the communication is not started by reading the cbnrx register.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 534 16.5.4 continuous mode (mast er mode, reception mode) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 2 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (8) (6) (6) (7) (5) (1) (2) (3) (4) 1 0 0 0 0 0 0 01 1 1 1 1 55h sckbn pin cbnsce bit sibn pin intcnr signal cbntsf bit shift register cbnrx register 1 1 0 55h aah aah 00h (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbnctl0.cbnrxe bit to 1 at the same time as specifying the transfer mode using the cbndir bit, to set the reception enabled status. (4) set the cbnpwr bit to 1 to enable the csibn operation. (5) perform a dummy read of the cbnrx register (reception start trigger). (6) the reception complete interrupt request signal (intcbnr) is output. read the cbnrx register before the next receive da ta arrives or before the cbnpwr bit is cleared to 0. (7) set the cbnctl0.cbnsce bit = 0 while the last dat a being received to set the final receive data status. (8) check that the cbnstr.cbntsf bit = 0 and set t he cbnpwr bit to 0 to stop the operation of csibn (end of reception). to continue transfer, repeat steps (5) and (6) before (7).
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 535 16.5.5 continuous reception mode (error) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 2 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (8) (9) (10) (7) (6) (5) aah 00h 1 0 0 0 0 0 01 1 1 1 1 sckbn pin sibn pin intcbnr signal cbntsf bit shift register cbnrx register cbnove bit 55h 55h 0 1 0 aah 1 (1) (2) (3) (4) (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbnctl0.cbnrxe bit to 1 at the same time as specifying the transfer mode using the cbndir bit, to set the reception enabled status. (4) set the cbnpwr bit = 1 to enable csibn operation. (5) perform a dummy read of the cbnrx register (reception start trigger). (6) the reception complete interrupt request signal (intcbnr) is output. (7) if the data could not be read befor e the end of the next transfer, the cbnstr.cbnove flag is set to 1 upon the end of reception and the intcbnr signal is output. (8) overrun error processing is performed after checki ng that the cbnove bit = 1 in the intcbnr interrupt servicing. (9) clear cbnove bit to 0. (10) check that the cbnstr.cbntsf bit = 0 and set the cbnpwr bit to 0 to stop the operation csibn (end of reception).
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 536 16.5.6 continuous mode (slave m ode, transmission/reception mode) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 2 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.csncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (8) (7) (7) (6) (5) 96h 00h cch 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 55h cbntx register sckbn pin sobn pin sibn pin intcbnt signal intcbnr signal shift register so latch cbnrx register 0 0 0 0 0 0 aah 96h cch 1 0 0 0 1 1 cbntsf bit cbnsce bit (1) (2) (3) (4) (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbntxe, cbnrxe and cbnsce bits of the cbnctl0 register to 1 at the same time as specifying the transfer mode using the cbndir bit, to set the transmission/reception enabled status. (4) set the cbnpwr bit to 1 to enable supply of the csibn operation. (5) write the transfer data to the cbntx register. (6) the transmission enable interrupt request signal (int cbnt) is received and the transfer data is written to the cbntx register. (7) the reception complete interrupt request signal (intcbnr) is output. read the cbnrx register. (8) check that the cbnstr.cbntsf bit = 0 and set t he cbnpwr bit to 0 to stop the operation of csibn (end of transmission/reception). to continue transfer, repeat st eps (5) to (7) before (8).
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 537 16.5.7 continuous mode (s lave mode, reception mode) this section shows the case using msb first (cbn ctl0.cbndir bit = 0) and communication type 1 (see 16.4 (2) csibn control register 1 (cbnctl1) ), transfer data length = 8 bits (cbnct l2.cbncl3 to cbnctl2.cbncl0 bits = 0, 0, 0, 0). (7) (6) (6) (5) 1 0 0 0 0 0 0 01 1 1 1 1 55h sckbn pin sibn pin intcbnr signal cbntsf bit cbnsce bit shift register cbnrx register 1 1 55h aah 00h aah 0 (1) (2) (3) (4) (1) clear the cbnctl0.cbnpwr bit to 0. (2) set the cbnctl1 and cbnctl2 registers to specify the transfer mode. (3) set the cbnctl0.cbnrxe and cbnctl0.cbnsce bits to 1 at the same time as specifying the transfer mode using the cbndir bit, to set the reception enabled status. (4) set the cbnpwr bit = 1 to enable csibn operation. (5) perform a dummy read of the cbnrx register (reception start trigger). (6) the reception complete interrupt request signal (intcbnr) is output. read the cbnrx register. when reading the last data, clear the cbnctl0.cbnsce bit to 0 before reading the cbnrx register. (7) check that the cbnstr.cbntsf bit = 0 and set t he cbnpwr bit to 0 to stop the operation of csibn (end of reception). to continue transfer, repeat steps (5) and (6) before (7).
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 538 16.5.8 clock timing (1/2) (1) communication type 1 (cbnckp = 0, cbndap = 0) d6 d5 d4 d3 d2 d1 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit d0 d7 (2) communication type 2 (cbnckp = 0, cbndap = 1) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit notes 1. the intcbnt interrupt is set when the data written to the transmit buffer is transferred to the data shift register in the continuous transmission or continuous transmission/reception mode. in the single transmission or single transmission/reception mode, the intcbnt interrupt request signal is not generated, but the intcbnr interrupt request signal is generated upon completion of communication. 2. the intcbnr interrupt occurs if reception is co rrectly completed and receive data is ready in the cbnrx register while reception is enabled, and if an overrun error occurs. in the single mode, the intcbnr interrupt request signal is generated even in the transmission mode, upon completion of communication. caution in communication type 2, the cbntsf bit is cleared half a s ckbn clock after generation of an intcbnr interrupt request signal.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 539 (2/2) (3) communication type 3 (cbnckp = 1, cbndap = 0) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit (4) communication type 4 (cbnckp = 1, cbndap = 1) d6 d5 d4 d3 d2 d1 d0 d7 sckbn pin sibn capture reg-r/w sobn pin intcbnt interrupt note 1 intcbnr interrupt note 2 cbntsf bit notes 1. the intcbnt interrupt is set when the data written to the transmit buffer is transferred to the data shift register in the continuous transmission or continuous transmission/reception modes. in the single transmission or single transmission/reception modes, the intcbnt interrupt request signal is not generated, but the intcbnr interrupt request signal is generated upon completion of communication. 2. the intcbnr interrupt occurs if reception is co rrectly completed and receive data is ready in the cbnrx register while reception is enabled, and if an overrun error occurs. in the single mode, the intcbnr interrupt request signal is generated even in the transmission mode, upon completion of communication. caution in communication type 4, the cbntsf bit is cleared half a s ckbn clock after generation of an intcbnr interrupt request signal.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 540 16.6 output pins (1) sckbn pin when csibn operation is disabled (cbnctl0.cbnpwr bit = 0), the sckbn pin output status is as follows. cbncks2 cbncks1 cbncks0 cbnckp sckbn pin output 1 1 1 high impedance 0 fixed to high level other than above 1 fixed to low level remarks 1. the output level of the sckbn pin chan ges if any of the cbnctl1.cbnckp and cbncks2 to cbncks0 bits is rewritten. 2. n = 0 to 5 3. : don't care (2) sobn pin when csibn operation is disabled (cbnpwr bit = 0), the sobn pin output status is as follows. cbntxe cbndap cbndir sobn pin output 0 fixed to low level 0 sobn latch value (low level) 0 cbntx register value (msb) 1 1 1 cbntx register value (lsb) remarks 1. the sobn pin output chan ges when any one of the cbnctl0.cbntxe, cbnctl0.cbndir bits, and cbnctl1.cbndap bit is rewritten. 2. n = 0 to 5 3. : don't care
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 541 16.7 operation flow (1) single transmission start no yes intcbnr signal is generated? transfer data exists? end yes no initial setting (cbnctl0 note , cbnctl1 registers, etc.) write cbntx register (start transfer). cbnpwr bit = 0 (cbnctl0) note set the cbnsce bit to 1 in the initial setting. caution in the slave mode, data cannot be correctly transmitted if the next transfer clock is input earlier than the cbntx register is written. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 542 (2) single reception start no intcbnr signal is generated? last data? end yes yes no initial setting (cbnctl0 note , cbnctl1 registers, etc.) cbnrx register dummy read (start reception) cbnsce bit = 0 (cbnctl0) cbnpwr bit = 0 (cbnctl0) cbnrx register read cbnrx register read note set the cbnsce bit to 1 in the initial setting. caution in the single mode, data cannot be correctly received if the next transfer clock is input earlier than the cbnrx register is read. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 543 (3) single transmission/reception start initial setting (cbnctl0 note 1 , cbnctl1 registers, etc.) write cbntx register (start transfer). end cbnpwr bit = 0, cbntxe bit = cbnrxe bit = 0 (cbnctl0) no transmission/reception transmission reception intcbnr signal is generated? yes transfer end? write cbntx register note 2 . read cbnrx register. read cbnrx register. no yes transfer end? write cbntx register note 2 . no yes transfer end? write cbntx register note 2 . no yes b b a a notes 1. set the cbnsce bit to 1 in the initial setting. 2. if the next transfer is reception only, dum my data is written to the cbntx register. caution even in the single mode, the cbnstr.cbnove flag is set to 1. if only transmission is used in the transmission/r eception mode, therefore, chec king the cbnove flag is not required. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 544 (4) continuous transmission start no yes intcbnt signal is generated? data to be transferred next exists? end yes no initial setting (cbnctl0 note , cbnctl1 registers, etc.) write cbntx register (start transfer). cbnpwr bit = 0 (cbnctl0) no cbntsf bit = 1? (cbnstr) yes note set the cbnsce bit to 1 in the initial setting. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 545 (5) continuous reception start end no no yes intcbnr signal is generated? cbnove bit = 1? (cbnstr) no yes initial setting (cbnctl0 note , cbnctl1 registers, etc.) cbnrx register dummy read (start reception) cbnrx register read cbnrx register read cbnrx register read cbnrx register read yes is data being received last data? cbnsce bit = 0 (cbnctl0) cbnsce bit = 1 (cbnctl0) no intcbnr signal is generated ? yes cbnove bit clear (cbnstr) note set the cbnsce bit to 1 in the initial setting caution in the master mode, the clock is output wit hout limit when dummy da ta is read from the cbnrx register. to stop the cl ock, execute the flow marked in the above flowchart. in the slave mode, malfunction due to no ise during communication can be prevented by executing the flow marked in the above flowchart. before resuming communication, set the cbn ctl0.cbnsce bit to 1, and read dummy data from the cbnrx register. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 546 (6) continuous transmission/reception start end no no intcbnr signal is generated? yes no intcbnt signal is generated ? yes initial setting (cbnctl0 note , cbnctl1 registers, etc.) write cbntx register. cbnrx register read yes yes is data completely received last data? no write cbntx register. yes is data being transferred last data? no cbnove bit = 0? (cbnstr) cbnove bit clear (cbnstr) note set the cbnsce bit to 1 in the initial setting. remark n = 0 to 5
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 547 16.8 baud rate generator the brg1 to brg3 and csib0 to csib5 baud rate generators are connected as shown in the following block diagram. csib0 csib1 csib2 csib3 csib4 brg1 brg2 brg3 csib5 f x f x f x f brg1 f brg2 f brg3 (1) prescaler mode registers 1 to 3 (prsm1 to prsm3) the prsm1 to prsm3 registers control generation of the baud rate signal for csib. these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. 0 prsmm (m = 1 to 3) 0 0 bgcem 0 0 bgcsm1 bgcsm0 disabled enabled bgcem 0 1 baud rate output f xx f xx /2 f xx /4 f xx /8 setting value (k) 0 1 2 3 bgcsm1 0 0 1 1 bgcsm0 0 1 0 1 input clock selection (f bgcsm ) after reset: 00h r/w address: prsm1 fffff320h, prsm2 fffff324h, prsm3 fffff328h < > cautions 1. do not rewrite the prsmm register during operation. 2. set the prsmm register befo re setting the bgcem bit to 1.
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 548 (2) prescaler compare registers 1 to 3 (prscm1 to prscm3) the prscm1 to prscm3 registers are 8-bit compare registers. these registers can be read or written in 8-bit units. reset sets these registers to 00h. prscmm7 prscmm (m = 1 to 3) prscmm6 prscmm5 prscmm4 prscmm3 prscmm2 prscmm1 prscmm0 after reset: 00h r/w address: prscm1 fffff321h, prscm2 fffff325h, prscm3 fffff329h cautions 1. do not rewrite the pr scmm register during operation. 2. set the prscmm register before setting the prsmm.bgcem bit to 1. 16.8.1 baud rate generation the transmission/reception clock is generated by dividing the main clock. the baud rate generated from the main clock is obtained by the following equation. f brgm = remark f brgm : brgm count clock f xx : main clock oscillation frequency k: prsmm register setting value = 0 to 3 n: prscmm register setting value = 1 to 256 however, n = 256 only when prscmm register is set to 00h. m = 1 to 3 f xx 2 k+1 n
chapter 16 3-wire variable-length serial i/o (csib) preliminary user's manual u17714ej1v0ud 549 16.9 cautions (1) when transferring transmit data and receive data using dma transfer, error processing cannot be performed even if an overrun error occurs during serial transfer. check that the no overrun error has occurred by reading the cbnstr.cbnove bit after dma transfer has been completed. (2) in regards to registers that are forbidden from bei ng rewritten during operations (cbnctl0.cbnpwr bit is 1), if rewriting has been carried out by mistake during oper ations, set the cbnctl0.cbnpwr bit to 0 once, then initialize csibn. registers to which rewriting during op eration are prohibited are shown below. ? cbnctl0 register: cbntxe, cbnrxe, cbndir, cbntms bits ? cbnctl1 register: cbnckp, cbndap, cbncks2 to cbncks0 bits ? cbnctl2 register: cbncl3 to cbncl0 bits (3) in communication type 2 and 4 (cbnctl1.cbndap bit = 1), the cbnstr.cbntsf bit is cleared half a sckbn clock after occurrence of a reception complete interrupt (intcbnr). in the single transfer mode, writing the next transmit data is ignored during communication (cbntsf bit = 1), and the next communication is not st arted. also if reception-only co mmunication (cbnctl0.cbntxe bit = 0, cbnctl0.cbnrxe bit = 1) is set, the next communication is not started even if the receive data is read during communication (cbntsf bit = 1). therefore, when using the single transfer mode with communication type 2 or 4 (cbndap bit = 1), pay particular attention to the following. ? to start the next transmission, confirm that cbntsf bit = 0 and then write the transmit data to the cbntx register. ? to perform the next reception continuously when re ception-only communication (cbntxe bit = 0, cbnrxe bit = 1) is set, confirm that cbntsf bit = 0 and then read the cbnrx register. or, use the continuous transfer mode inst ead of the single transfer mode. us e of the continuous transfer mode is recommend especially for using dma. remark n = 0 to 5
preliminary user's manual u17714ej1v0ud 550 chapter 17 i 2 c bus to use the i 2 c bus function, use the p38/ sda00, p39/scl00, p40/sda01, p41/scl01, p90/sda02, and p91/scl02 pins as the serial transmit/receive data i/o pins (sda00 to sda02) and serial clock i/o pins (scl00 to scl02), respectively, and set them to n-ch open-drain output . 17.1 mode switching of i 2 c bus and other serial interfaces 17.1.1 uarta2 and i 2 c00 mode switching in the v850es/jj2, uarta2 and i 2 c00 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c00 in advance, using the pmc3 and pfc3 registers, before use. caution the transmit/receive operation of uarta2 and i 2 c00 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-1. uarta2 and i 2 c00 mode switch settings pmc3 after reset: 0000h r/w address: fffff446h, fffff447h 0 0 pmc35 pmc34 pmc33 pmc32 pmc31 pmc30 0 0 0 0 0 0 pmc39 pmc38 8 9 10 11 12 13 14 15 pfc3 after reset: 0000h r/w address: fffff466h, fffff467h 0 0 0 0 0 0 pfc39 pfc38 0 0 pfc35 pfc34 pfc33 pfc32 pfc31 pfc30 8 9 10 11 12 13 14 15 port i/o mode uarta2 mode i 2 c00 mode pmc3n 0 1 1 operation mode pfc3n 0 1 remarks 1. n = 8, 9 2. = don't care
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 551 17.1.2 csib0 and i 2 c01 mode switching in the v850es/jj2, csib0 and i 2 c01 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c01 in advance, using the pmc4 and pfc4 registers, before use. caution the transmit/receive operation of csib0 and i 2 c01 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-2. csib0 and i 2 c01 mode switch settings port i/o mode csib0 mode i 2 c01 mode pmc4n 0 1 1 operation mode pfc4n 0 1 0 pmc4 0 0 0 0 pmc42 pmc41 pmc40 after reset: 00h r/w address: fffff448h pfc4 after reset: 00h r/w address: fffff468h 0 0 0 0 0 0 pfc41 pfc40 remarks 1. n = 0, 1 2. = don't care
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 552 17.1.3 uarta1 and i 2 c02 mode switching in the v850es/jj2, uarta1 and i 2 c02 are alternate functions of the same pin and therefore cannot be used simultaneously. set i 2 c02 in advance, using the pmc9, pfc9 , and pmce9 registers, before use. caution the transmit/receive operation of uarta1 and i 2 c02 is not guaranteed if these functions are switched during transmission or reception. be sure to disable the one that is not used. figure 17-3. uarta1 and i 2 c02 mode switch settings pmc9 after reset: 0000h r/w address: fffff452h, fffff453h pmc97 pmc96 pmc95 pmc94 pmc93 pmc92 pmc91 pmc90 pmc915 pmc914 pmc913 pmc912 pmc911 pmc910 pmc99 pmc98 8 9 10 11 12 13 14 15 pfc9 after reset: 0000h r/w address: fffff472h, fffff473h pfc915 pfc914 pfc913 pfc912 pfc911 pfc910 pfc99 pfc98 pfc97 pfc96 pfc95 pfc94 pfc93 pfc92 pfc91 pfc90 8 9 10 11 12 13 14 15 pfce915 pfce914 0 0 0 0 0 0 pfce97 pfce96 pfce95 pfce94 pfce93 pfce92 pfce91 pfce90 8 9 10 11 12 13 14 15 pfce9 after reset: 0000h r/w address: fffff712h, fffff713h uarta1 mode i 2 c02 mode pmc9n 1 1 operation mode pfce9n 1 1 pfc9n 0 1 remark n = 0, 1
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 553 17.2 features i 2 c00 to i 2 c02 have the following two modes. ? operation stopped mode ? i 2 c (inter ic) bus mode (multimasters supported) (1) operation stopped mode in this mode, serial transfers are not performed, thus enabling a reduction in power consumption. (2) i 2 c bus mode (multimaster support) this mode is used for 8-bit data transfers with several devices via two lines: a serial clock pin (scl0n) and a serial data bus pin (sda0n). this mode complies with the i 2 c bus format and the master device can generate "start condition", "address", "transfer direction specification", " data", and "stop condition" data to the sl ave device via the serial data bus. the slave device automatically detects the received status es and data by hardware. this function can simplify the part of an application progr am that controls the i 2 c bus. since scl0n and sda0n pins are us ed for n-ch open-drain outputs, i 2 c0n requires pull-up resistors for the serial clock line and the serial data bus line. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 554 17.3 configuration the block diagram of the i 2 c0n is shown below. figure 17-4. block diagram of i 2 c0n internal bus iic status register n (iicsn) iic control register n (iiccn) so latch iicen dq cln1, cln0 trcn dfcn dfcn sda0n scl0n output control intiicn iic shift register n (iicn) iiccn.sttn, sptn iicsn.mstsn, excn, coin iicsn.mstsn, excn, coin lreln wreln spien wtimn acken sttn sptn mstsn aldn excn coin trcn ackdn stdn spdn internal bus cldn dadn smcn dfcn cln1 cln0 clxn iic clock select register n (iiccln) stcfn iicbsyn stcenn iicrsvn iic flag register n (iicfn) iic function expansion register n (iicxn) fxx iic division clock select register m (ocksm) fxx to fxx/5 ocksthm ocksenm ocksm1 ocksm0 clear slave address register n (svan) match signal set noise eliminator iic shift register n (iicn) data retention time correction circuit n-ch open-drain output ack detector ack generator start condition detector stop condition detector serial clock counter serial clock controller noise eliminator n-ch open-drain output start condition generator stop condition generator wakeup controller interrupt request signal generator serial clock wait controller bus status detector prescaler prescaler remark n = 0 to 2 m = 0, 1
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 555 a serial bus configuration example is shown below. figure 17-5. serial bus configuration example using i 2 c bus sda scl sda +v dd +v dd scl sda scl slave cpu3 address 3 sda scl slave ic address 4 sda scl slave ic address n master cpu1 slave cpu1 address 1 serial data bus serial clock master cpu2 slave cpu2 address 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 556 i 2 c0n includes the following hardware (n = 0 to 2). table 17-1. configuration of i 2 c0n item configuration registers iic shift register n (iicn) slave address register n (svan) control registers iic control register n (iiccn) iic status register n (iicsn) iic flag register n (iicfn) iic clock select register n (iiccln) iic function expansion register n (iicxn) iic division clock select registers 0, 1 (ocks0, ocks1) (1) iic shift register n (iicn) the iicn register converts 8-bit serial data into 8- bit parallel data and vice versa, and can be used for both transmission and reception (n = 0 to 2). write and read operations to the iicn r egister are used to control the act ual transmit and receive operations. this register can be read or written in 8-bit units. reset sets this register to 00h. (2) slave address register n (svan) the svan register sets local addresses when in slave mode (n = 0 to 2). this register can be read or written in 8-bit units. reset sets this register to 00h. (3) so latch the so latch is used to retain the output level of the sda0n pin (n = 0 to 2). (4) wakeup controller this circuit generates an interrupt r equest signal (intiicn) when the address re ceived by this register matches the address value set to the svan register or w hen an extension code is received (n = 0 to 2). (5) prescaler this selects the sampling clock to be used. (6) serial clock counter this counter counts the serial clocks that are output and the serial clocks t hat are input during transmit/receive operations and is used to verify that 8-bit data was transmitted or received.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 557 (7) interrupt request signal generator this circuit controls the generation of interrupt request signals (intiicn). an i 2 c interrupt is generated followi ng either of two triggers. ? falling edge of eighth or ninth clock of the serial clock (set by iiccn.wtimn bit) ? interrupt occurrence due to stop conditi on detection (set by iiccn.spien bit) remark n = 0 to 2 (8) serial clock controller in master mode, this circuit generates the clock output via the scl0n pin from the sampling clock (n = 0 to 2). (9) serial clock wait controller this circuit controls the wait timing. (10) ack generator, stop condition detector, start condition detector, and ack detector these circuits are used to gener ate and detect various statuses. (11) data hold time correction circuit this circuit generates the hold time for data corresponding to the falling edge of the scl0n pin. (12) start condition generator a start condition is generated when the iiccn.sttn bit is set. however, in the communication reservation disabled st atus (iicfn.iicrsvn bit = 1), this request is ignored and the iicfn.stcfn bit is set to 1 if the bus is not released (iicfn.iicbsyn bit = 1). (13) stop condition generator a stop condition is generated when the iiccn.sptn bit is set. (14) bus status detector whether the bus is released or not is ascertai ned by detecting a start c ondition and stop condition. however, the bus status c annot be detected immediately a fter operation, so set the bus status detector to the initial status by using the iicfn.stcenn bit.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 558 17.4 registers i 2 c00 to i 2 c02 are controlled by t he following registers. ? iic control registers 0 to 2 (iicc0 to iicc2) ? iic status registers 0 to 2 (iics0 to iics2) ? iic flag registers 0 to 2 (iicf0 to iicf2) ? iic clock select registers 0 to 2 (iiccl0 to iiccl2) ? iic function expansion registers 0 to 2 (iicx0 to iicx2) ? iic division clock select r egisters 0, 1 (ocks0, ocks1) the following registers are also used. ? iic shift registers 0 to 2 (iic0 to iic2) ? slave address registers 0 to 2 (sva0 to sva2) remark for the alternate-function pin settings, see table 4-19 using port pin as alternate-function pin . (1) iic control registers 0 to 2 (iicc0 to iicc2) the iiccn register enables/stops i 2 c0n operations, sets the wait timing, and sets other i 2 c operations (n = 0 to 2). this register can be read or written in 8-bit or 1-bit units. however, set the spien, wtimn, and acken bits when the iicen bit is 0 or during the wa it period. when setting the iicen bit fr om "0" to "1", these bits can also be set at the same time. reset sets this register to 00h.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 559 (1/4) after reset: 00h r/w address: iicc0 fffffd82h, iicc1 fffffd92h, iicc2 fffffda2h <7> <6> <5> <4> <3> <2> <1> <0> iiccn iicen lreln wreln spien wtimn acken sttn sptn (n = 0 to 2) iicen specification of i 2 cn operation enable/disable 0 operation stopped. iicsn register reset note 1 . internal operation stopped. 1 operation enabled. be sure to set this bit to 1 when the scl0n and sda0n lines are high level. condition for clearing (iicen bit = 0) condition for setting (iicen bit = 1) ? cleared by instruction ? after reset ? set by instruction lreln note 2 exit from communications 0 normal operation 1 this exits from the current communication oper ation and sets standby mode. this setting is automatically cleared after being ex ecuted. its uses include cases in which a locally irrelevant extension code has been received. the scl0n and sda0n lines are set to high impedance. the sttn and sptn bits and the mstsn, excn, coin , trcn, ackdn, and stdn bits of the iicsn register are cleared. the standby mode following exit from communications rema ins in effect until the following communication entry conditions are met. ? after a stop condition is detected, restart is in master mode. ? an address match occurs or an extension code is received after the start condition. condition for clearing (lreln bit = 0) condition for setting (lreln bit = 1) ? automatically cleared after execution ? after reset ? set by instruction wreln note 2 wait state cancellation control 0 wait state not canceled 1 wait state canceled. this setting is automat ically cleared after wait state is canceled. condition for clearing (wreln bit = 0) condition for setting (wreln bit = 1) ? automatically cleared after execution ? after reset ? set by instruction notes 1. the iicsn register, iicfn.stcfn and iicfn.iic bsyn bits, and iiccln.cldn and iiccln.dadn bits are reset. 2. this flag's signal is invalid when the iicen bit = 0. caution if the i 2 cn operation is enabled (iicen bit = 1) when the scl0n line is high level and the sda0n line is low level, the start condition is detected immediately. to avoid this, after enabling the i 2 cn operation, immediately set the lr eln bit to 1 with a bit manipulation instruction. remark the lreln and wreln bits are 0 when read after the data has been set.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 560 (2/4) spien note enable/disable generation of interrupt request when stop condition is detected 0 disabled 1 enabled condition for clearing (spien bit = 0) condition for setting (spien bit = 1) ? cleared by instruction ? after reset ? set by instruction wtimn note control of wait state and interrupt request generation 0 interrupt request is generated at the eighth clock's falling edge. master mode: after output of eight clocks, clock output is set to low level and the wait state is set. slave mode: after input of eight clocks, the clock is set to low level and the wait state is set for the master device. 1 interrupt request is generated at the ninth clock's falling edge. master mode: after output of nine clocks, clock output is set to low level and the wait state is set. slave mode: after input of nine clocks, the clock is set to low level and the wait state is set for the master device. during address transfer, an interrupt occurs at the falling edge of the ninth clock regardless of this bit setting. this bit setting becomes valid when the address transfer is complet ed. in master mode, a wait state is inserted at the falling edge of the ninth clock during address transfer. for a slave device that has rece ived a local address, a wait state is inserted at the falling edge of the ninth clock a fter ack is generated. when t he slave device has received an extension code, however, a wait state is inserted at the falling edge of the eighth clock. condition for clearing (wtimn bit = 0) condition for setting (wtimn bit = 1) ? cleared by instruction ? after reset ? set by instruction acken note acknowledgment control 0 acknowledgment disabled. 1 acknowledgment enabled. during t he ninth clock period, the sda0n line is set to low level. the acken bit setting is invalid for address reception by the slave device. in this case, ack is generated when the addresses match. however, the acken bit setting is valid for reception of the extension code. set the acken bit in the system that receives the extension code. condition for clearing (acken bit = 0) condition for setting (acken bit = 1) ? cleared by instruction ? after reset ? set by instruction note this flag's signal is invalid when the iicen bit = 0. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 561 (3/4) sttn start condition trigger 0 start condition is not generated. 1 when bus is released (in stop mode): a start condition is generated (for st arting as master). the sda0n line is changed from high level to low level while the scln line is high level and then the start condition is generated. next, after the rated amount of time has elapsed, the scl0n line is changed to low level. during communication with a third party: if the communication reservation functi on is enabled (iicfn.iicrsvn bit = 0) ? this trigger functions as a star t condition reserve flag. when set to 1, it releases the bus and then automatically generates a start condition. if the communication reservation f unction is disabled (iicrsvn = 1) ? the iicfn.stcfn bit is set to 1 to clear the info rmation set (1) to the sttn bit. this trigger does not generate a start condition. in the wait state (when master device): a restart condition is generated afte r the wait state is released. cautions concerning set timing for master reception: cannot be set to 1 during transfer. can be set to 1 only when the acken bit has been set to 0 and the slave has been notified of final reception. for master transmission: a start condition cannot be generat ed normally during the ack period. set to 1 during the wait period that follows output of the ninth clock. for slave: even when the communication reservati on function is disabled (iicrsvn bit = 1), the communication reservation status is entered. ? setting to 1 at the same time as the sptn bit is prohibited. ? when the sttn bit is set to 1, setting the sttn bit to 1 again is disabled until the setting is cleared to 0. condition for clearing (sttn bit = 0) condition for setting (sttn bit = 1) ? when the sttn bit is set to 1 in the communication reservation disabled status ? cleared by loss in arbitration ? cleared after start condition is generated by master device ? when the lreln bit = 1 (communication save) ? when the iicen bit = 0 (operation stop) ? after reset ? set by instruction remarks 1. the sttn bit is 0 if it is read immediately after data setting. 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 562 (4/4) sptn stop condition trigger 0 stop condition is not generated. 1 stop condition is generated (terminati on of master device's transfer). after the sda0n line goes to low level, either set the scl0n line to high level or wait until the scl0n pin goes to high level. next, after the rated am ount of time has elapsed, the sda0n line is changed from low level to high level and a stop condition is generated. cautions concerning set timing for master reception: cannot be set to 1 during transfer. can be set to 1 only when the acken bit has been set to 0 and during the wait period after the slave has been notified of final reception. for master transmission: a stop condition cannot be generat ed normally during the ack reception period. set to 1 during the wait period that follows output of the ninth clock. ? cannot be set to 1 at the same time as the sttn bit. ? the sptn bit can be set to 1 only when in master mode note . ? when the wtimn bit has been set to 0, if the sptn bit is set to 1 during the wait period that follows output of eight clocks, note that a stop condition will be generated during the high-level period of the ninth clock. the wtimn bit should be changed from 0 to 1 during the wait period following output of eight clocks, and the sptn bit should be set to 1 during the wait peri od that follows output of the ninth clock. ? when the sptn bit is set to 1, setting the sptn bit to 1 again is disabled until the setting is cleared to 0. condition for clearing (sptn bit = 0) condition for setting (sptn bit = 1) ? cleared by loss in arbitration ? automatically cleared after stop condition is detected ? when the lreln bit = 1 (communication save) ? when the iicen bit = 0 (operation stop) ? after reset ? set by instruction note set the sptn bit to 1 only in master mode. howeve r, when the iicrsvn bit is 0, the sptn bit must be set to 1 and a stop condition generated before the firs t stop condition is detect ed following the switch to the operation enabled stat us. for details, see 17.15 cautions . caution when the trcn bit = 1, the wreln bit is set to 1 during the ninth clock and the wait state is canceled, after which th e trcn bit is cleared to 0 and the sda0n line is set to high impedance. remarks 1. the sptn bit is 0 if it is r ead immediately after data setting. 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 563 (2) iic status registers 0 to 2 (iics0 to iics2) the iicsn register indica tes the status of the i 2 c0n (n = 0 to 2). this register is read-only, in 8-bit or 1-bit units. however, the iicsn regist er can only be read when the iiccn.sttn bit is 1 or during the wait period. reset sets this register to 00h. caution accessing the iicsn register is prohibited in the following stat uses. for details, see 3.4.8 (2) accessing specific on-chip pe ripheral i/o registers. ? when the cpu operates with the subclock and the main clock oscillation is stopped ? when the cpu operates with th e internal oscillation clock (1/3) after reset: 00h r address: iics0 fffffd86h, iics1 fffffd96h, iics2 fffffda6h <7> <6> <5> <4> <3> <2> <1> <0> iicsn mstsn aldn excn coin trcn ackdn stdn spdn (n = 0 to 2) mstsn master device status 0 slave device status or communication standby status 1 master device communication status condition for clearing (mstsn bit = 0) condition for setting (mstsn bit = 1) ? when a stop condition is detected ? when the aldn bit = 1 (arbitration loss) ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a start condition is generated aldn arbitration loss detection 0 this status means either that there was no arbitr ation or that the arbitration result was a "win". 1 this status indicates the arbitration result was a "loss". the mstsn bit is cleared to 0. condition for clearing (aldn bit = 0) condition for setting (aldn bit = 1) ? automatically cleared after the iicsn register is read note ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the arbitration result is a "loss". excn detection of extension code reception 0 extension code was not received. 1 extension code was received. condition for clearing (excn bit = 0) condition for setting (excn bit = 1) ? when a start condition is detected ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the higher four bits of the received address data are either "0000" or "1111" (set at the rising edge of the eighth clock). note the aldn bit is also cleared when a bit manipul ation instruction is ex ecuted for another bit in the iicsn register.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 564 (2/3) coin matching address detection 0 addresses do not match. 1 addresses match. condition for clearing (coin bit = 0) condition for setting (coin bit = 1) ? when a start condition is detected ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when the received address matches the local address (svan register) (set at the rising edge of the eighth clock). trcn transmit/receive status detection 0 receive status (other than transmit status ). the sda0n line is set to high impedance. 1 transmit status. the value in t he so latch is enabled for output to the sda0n line (valid starting at the falling edge of the first byte's ninth clock). condition for clearing (trcn bit = 0) condition for setting (trcn bit = 1) ? when a stop condition is detected ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? cleared by iiccn.wreln bit = 1 note ? when the aldn bit changes from 0 to 1 (arbitration loss) ? after reset master ? when "1" is output to the first byte's lsb (transfer direction specification bit) slave ? when a start condition is detected when not used for communication master ? when a start condition is generated ? when "0" is output to the first byte's lsb (transfer direction specification bit) slave ? when "1" is input by the first byte's lsb (transfer direction specification bit) ackdn ack detection 0 ack was not detected. 1 ack was detected. condition for clearing (ackdn bit = 0) condition for setting (ackdn bit = 1) ? when a stop condition is detected ? at the rising edge of the next byte's first clock ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? after the sda0n bit is set to low level at the rising edge of the scl0n pin's ninth clock note the trcn bit is cleared to 0 and sda0n li ne becomes high impedance when the wreln bit is set to 1 and the wait state is canceled to 0 at the ninth clock by trcn bit = 1. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 565 (3/3) stdn start condition detection 0 start condition was not detected. 1 start condition was detected. this indicates that the address transfer period is in effect condition for clearing (stdn bit = 0) condition for setting (stdn bit = 1) ? when a stop condition is detected ? at the rising edge of the next byte's first clock following address transfer ? cleared by lreln bit = 1 (communication save) ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a start condition is detected spdn stop condition detection 0 stop condition was not detected. 1 stop condition was detected. the master devic e's communication is terminated and the bus is released. condition for clearing (spdn bit = 0) condition for setting (spdn bit = 1) ? at the rising edge of the address transfer byte's first clock following setting of this bit and detection of a start condition ? when the iicen bit changes from 1 to 0 (operation stop) ? after reset ? when a stop condition is detected remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 566 (3) iic flag registers 0 to 2 (iicf0 to iicf2) the iicfn register sets the i 2 c0n operation mode and indicates the i 2 c bus status. this register can be read or written in 8-bit or 1-bit units. however, the stcfn and iicbsyn bits are read-only. iicrsvn enables/disables the communi cation reservation function (see 17.14 communication reservation ). the initial value of the iicbsyn bit is set by using the stcenn bit (see 17.15 cautions ). the iicrsvn and stcenn bits can be written only when operation of i 2 c0n is disabled (iiccn.iicen bit = 0). after operation is enabled, iicfn can be read (n = 0 to 2). reset sets this register to 00h.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 567 after reset: 00h r/w note address: iicf0 fffffd8ah, iicf1 fffffd9ah, iicf2 fffffdaah <7> <6> 5 4 3 2 <1> <0> iicfn stcfn iicbsyn 0 0 0 0 stcenn iicrsvn (n = 0 to 2) stcfn sttn bit clear 0 start condition issued 1 start condition cannot be issued, sttn bit cleared condition for clearing (stcfn bit = 0) condition for setting (stcfn bit = 1) ? cleared by iiccn.sttn bit = 1 ? when the iiccn.iicen bit = 0 ? after reset ? when start condition is not issued and sttn flag is cleared to 0 during communi cation reservation is disabled (iicrsvn bit = 1). iicbsyn i 2 c0n bus status 0 bus released status (default communi cation status when stcenn bit = 1) 1 bus communication status (default comm unication status when stcenn bit = 0) condition for clearing (iicbsyn bit = 0) condition for setting (iicbsyn bit = 1) ? when stop condition is detected ? when the iicen bit = 0 ? after reset ? when start condition is detected ? by setting the iicen bit when the stcenn bit = 0 stcenn initial start enable trigger 0 start conditions cannot be generated until a stop condition is detected following operation enable (iicen bit = 1). 1 start conditions can be generated even if a stop condition is not detected following operation enable (iicen bit = 1). condition for clearing (stcenn bit = 0) condition for setting (stcenn bit = 1) ? when start condition is detected ? after reset ? setting by instruction iicrsvn communication reserv ation function disable bit 0 communication reservation enabled 1 communication reservation disabled condition for clearing (iicrsvn bit = 0) condition for setting (iicrsvn bit = 1) ? clearing by instruction ? after reset ? setting by instruction note bits 6 and 7 are read-only bits. cautions 1. write the stcenn bit only wh en operation is stopped (iicen bit = 0). 2. when the stcenn bit = 1, the bus rel eased status (iicbsyn bit = 0) is recognized regardless of the actual bus st atus immediately after the i 2 cn bus operation is enabled. therefore, to i ssue the first start condition (sttn bit = 1), it is necessary to confirm that the bus has been released, so as to not disturb other communications. 3. write the iicrsvn bit only when operation is stopped (iicen bit = 0).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 568 (4) iic clock select registers 0 to 2 (iiccl0 to iiccl2) the iiccln register sets the transfer clock for the i 2 c0n. this register can be read or written in 8-bit or 1-bit units. however, the cldn and dadn bits are read-only. set the iiccln register when the iiccn.iicen bit = 0. the smcn, cln1, and cln0 bits are set by the co mbination of the iicxn.clxn bit and the ocksthm, ocksm1, and ocksm0 bits of the ocksm register (see 17.4 (6) i 2 c0n transfer clock setting method ) (n = 0 to 2, m = 0, 1). reset sets this register to 00h. after reset: 00h r/w note address: iiccl0 fffffd84h, iiccl1 fffffd94h, iiccl2 fffffda4h 7 6 <5> <4> 3 2 1 0 iiccln 0 0 cldn dadn smcn dfcn cln1 cln0 (n = 0 to 2) cldn detection of scl0n pin level (valid only when iiccn.iicen bit = 1) 0 the scl0n pin was detected at low level. 1 the scl0n pin was detected at high level. condition for clearing (cldn bit = 0) condition for setting (cldn bit = 1) ? when the scl0n pin is at low level ? when the iicen bit = 0 (operation stop) ? after reset ? when the scl0n pin is at high level dadn detection of sda0n pin level (valid only when iicen bit = 1) 0 the sda0n pin was detected at low level. 1 the sda0n pin was detected at high level. condition for clearing (dadn bit = 0) condition for setting (dadn bit = 1) ? when the sda0n pin is at low level ? when the iicen bit = 0 (operation stop) ? after reset ? when the sda0n pin is at high level smcn operation mode switching 0 operation in standard mode. 1 operation in high-speed mode. dfcn digital filter operation control 0 digital filter off. 1 digital filter on. the digital filter can be used only in high-speed mode. in high-speed mode, the transfer clock does not vary regardless of the dfcn bit setting (on/off). the digital filter is used to e liminate noise in high-speed mode. note bits 4 and 5 are read-only bits. caution be sure to clear bits 7 and 6 to ?0?. remark when the iiccn.iicen bit = 0, 0 is r ead when reading the cldn and dadn bits.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 569 (5) iic function expansion register s 0 to 2 (iicx0 to iicx2) the iicxn register sets i 2 c0n function expansion (valid only in the high-speed mode). this register can be read or written in 8-bit or 1-bit units. setting of the clxn bit is performed in combination wit h the smcn, cln1, and cln0 bits of the iiccln register and the ocksthm, ocksm1, and ocksm0 bi ts of the ocksm register (see 17.4 (6) i 2 c0n transfer clock setting method ) (m = 0, 1). set the iicxn register when the iiccn.iicen bit = 0. reset sets this register to 00h. iicxn (n = 0 to 2) after reset: 00h r/w address: iicx0 fffffd85h, iicx1 fffffd95h, iicx2 fffffda5h 0 0 0 0 0 0 0 clxn < > (6) i 2 c0n transfer clock setting method the i 2 c0n transfer clock frequency (f scl ) is calculated using the following expression (n = 0 to 2). f scl = 1/(m t + t r + t f ) m = 12, 18, 24, 36, 44, 48, 54, 60, 66, 72, 86, 88, 96, 132, 172, 176, 198, 220, 258, 344 (see table 17-2 clock settings ). t: 1/f xx t r : scl0n pin rise time t f : scl0n pin fall time for example, the i 2 c0n transfer clock frequency (f scl ) when f xx = 19.2 mhz, m = 198, t r = 200 ns, and t f = 50 ns is calculated using following expression. f scl = 1/(198 52 ns + 200 ns + 50 ns) ? 94.7 khz m t + t r + t f m/2 t t f t r m/2 t scl0n scl0n inversion scl0n inversion scl0n inversion the clock to be selected can be set by the combinat ion of the smcn, cln1, and cln0 bits of the iiccln register, the clxn bit of the iicxn register, and the ocksthm, ocksm1, and ocksm0 bits of the ocksm register (n = 0 to 2, m = 0, 1).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 570 table 17-2. clock settings (1/2) iicx0 iiccl0 bit 0 bit 3 bit 1 bit 0 clx0 smc0 cl01 cl00 selection clock transfer clock settable main clock frequency (f xx ) range operating mode f xx (when ocks0 = 18h set) f xx /44 2.00 mhz f xx 4.19 mhz f xx /2 (when ocks0 = 10h set) f xx /88 4.00 mhz f xx 8.38 mhz f xx /3 (when ocks0 = 11h set) f xx /132 6.00 mhz f xx 12.57 mhz f xx /4 (when ocks0 = 12h set) f xx /176 8.00 mhz f xx 16.76 mhz 0 0 0 0 f xx /5 (when ocks0 = 13h set) f xx /220 10.00 mhz f xx 20.00 mhz f xx (when ocks0 = 18h set) f xx /86 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks0 = 10h set) f xx /172 8.38 mhz f xx 16.76 mhz f xx /3 (when ocks0 = 11h set) f xx /258 12.57 mhz f xx 20.00 mhz 0 0 0 1 f xx /4 (when ocks0 = 12h set) f xx /344 16.76 mhz f xx 20.00 mhz 0 0 1 0 f xx note f xx /86 4.19 mhz f xx 8.38 mhz f xx (when ocks0 = 18h set) f xx /66 6.40 mhz f xx /2 (when ocks0 = 10h set) f xx /132 12.80 mhz 0 0 1 1 f xx /3 (when ocks0 = 11h set) f xx /198 19.20 mhz standard mode (smc0 bit = 0) f xx (when ocks0 = 18h set) f xx /24 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks0 = 10h set) f xx /48 8.00 mhz f xx 16.76 mhz f xx /3 (when ocks0 = 11h set) f xx /72 12.00 mhz f xx 20.00 mhz 0 1 0 f xx /4 (when ocks0 = 12h set) f xx /96 16.00 mhz f xx 20.00 mhz 0 1 1 0 f xx note f xx /24 4.00 mhz f xx 8.38 mhz f xx (when ocks0 = 18h set) f xx /18 6.40 mhz f xx /2 (when ocks0 = 10h set) f xx /36 12.80 mhz 0 1 1 1 f xx /3 (when ocks0 = 11h set) f xx /54 19.20 mhz f xx (when ocks0 = 18h set) f xx /12 4.00 mhz f xx 4.19 mhz f xx /2 (when ocks0 = 10h set) f xx /24 8.00 mhz f xx 8.38 mhz f xx /3 (when ocks0 = 11h set) f xx /36 12.00 mhz f xx 12.57 mhz f xx /4 (when ocks0 = 12h set) f xx /48 16.00 mhz f xx 16.67 mhz 1 1 0 f xx /5 (when ocks0 = 13h set) f xx /60 20.00 mhz 1 1 1 0 f xx note f xx /12 4.00 mhz f xx 4.19 mhz high-speed mode (smc0 bit = 1) other than above setting prohibited ? ? ? note since the selection clock is f xx regardless of the value set to the oc ks0 register, clear the ocks0 register to 00h (i 2 c division clock stopped status). remark : don't care
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 571 table 17-2. clock settings (2/2) iicxm iicclm bit 0 bit 3 bit 1 bit 0 clxm smcm clm1 clm0 selection clock transfer clock settable main clock frequency (f xx ) range operating mode f xx (when ocks1 = 18h set) f xx /44 2.00 mhz f xx 4.19 mhz f xx /2 (when ocks1 = 10h set) f xx /88 4.00 mhz f xx 8.38 mhz f xx /3 (when ocks1 = 11h set) f xx /132 6.00 mhz f xx 12.57 mhz f xx /4 (when ocks1 = 12h set) f xx /176 8.00 mhz f xx 16.76 mhz 0 0 0 0 f xx /5 (when ocks1 = 13h set) f xx /220 10.00 mhz f xx 20.00 mhz f xx (when ocks1 = 18h set) f xx /86 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks1 = 10h set) f xx /172 8.38 mhz f xx 16.76 mhz f xx /3 (when ocks1 = 11h set) f xx /258 12.57 mhz f xx 20.00 mhz 0 0 0 1 f xx /4 (when ocks1 = 12h set) f xx /344 16.76 mhz f xx 20.00 mhz 0 0 1 0 f xx note f xx /86 4.19 mhz f xx 8.38 mhz f xx (when ocks1 = 18h set) f xx /66 6.40 mhz f xx /2 (when ocks1 = 10h set) f xx /132 12.80 mhz 0 0 1 1 f xx /3 (when ocks1 = 11h set) f xx /198 19.20 mhz standard mode (smcm bit = 0) f xx (when ocks1 = 18h set) f xx /24 4.19 mhz f xx 8.38 mhz f xx /2 (when ocks1 = 10h set) f xx /48 8.00 mhz f xx 16.76 mhz f xx /3 (when ocks1 = 11h set) f xx /72 12.00 mhz f xx 20.00 mhz 0 1 0 f xx /4 (when ocks1 = 12h set) f xx /96 16.00 mhz f xx 20.00 mhz 0 1 1 0 f xx note f xx /24 4.00 mhz f xx 8.38 mhz f xx (when ocks1 = 18h set) f xx /18 6.40 mhz f xx /2 (when ocks1 = 10h set) f xx /36 12.80 mhz 0 1 1 1 f xx /3 (when ocks1 = 11h set) f xx /54 19.20 mhz f xx (when ocks1 = 18h set) f xx /12 4.00 mhz f xx 4.19 mhz f xx /2 (when ocks1 = 10h set) f xx /24 8.00 mhz f xx 8.38 mhz f xx /3 (when ocks1 = 11h set) f xx /36 12.00 mhz f xx 12.57 mhz f xx /4 (when ocks1 = 12h set) f xx /48 16.00 mhz f xx 16.67 mhz 1 1 0 f xx /5 (when ocks1 = 13h set) f xx /60 20.00 mhz 1 1 1 0 f xx note f xx /12 4.00 mhz f xx 4.19 mhz high-speed mode (smcm bit = 1) other than above setting prohibited ? ? ? note since the selection clock is f xx regardless of the value set to the oc ks1 register, clear the ocks1 register to 00h (i 2 c division clock stopped status). remarks 1. m = 1, 2 2. : don't care
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 572 (7) iic division clock select regi sters 0, 1 (ocks0, ocks1) the ocksm register controls the i 2 c0n division clock (n = 0 to 2, m = 0, 1). this register controls the i 2 c00 division clock via the ocks0 register and the i 2 c01 and i 2 c02 division clocks via the ocks1 register. this register can be read or written in 8-bit units. reset sets this register to 00h. 0 ocksm (m = 0, 1) 00 ocksenm ocksthm 0 ocksm1 ocksm0 after reset: 00h r/w address: ocks0 fffff340h, ocks1 fffff344h disable i 2 c division clock operation enable i 2 c division clock operation ocksenm 0 1 operation setting of i 2 c division clock ocksm1 0 0 1 1 0 other than above ocksm0 0 1 0 1 0 selection of i 2 c division clock f xx /2 f xx /3 f xx /4 f xx /5 f xx setting prohibited ocksthm 0 0 0 0 1 (8) iic shift registers 0 to 2 (iic0 to iic2) the iicn register is used for serial transmission/recepti on (shift operations) synchronized with the serial clock. this register can be read or written in 8-bit units, but data should not be wri tten to the iicn register during a data transfer. access (read/write) the iicn register only during the wait period. accessi ng this register in communication states other than the wa it period is prohibited. howe ver, for the master device, t he iicn register can be written once only after the transmission trigger bit (iiccn.sttn bit) has been set to 1. a wait state is released by wr iting the iicn register during the wait period, and data transfe r is started (n = 0 to 2). reset sets this register to 00h. after reset: 00h r/w address: iic0 fffffd80h, iic1 fffffd90h, iic2 fffffda0h 7 6 5 4 3 2 1 0 iicn (n = 0 to 2)
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 573 (9) slave address registers 0 to 2 (sva0 to sva2) the svan register holds the i 2 c bus's slave addresses (n = 0 to 2). this register can be read or written in 8-bit units, but bit 0 should be fixed to 0. however, rewriting this register is prohibited when the iicsn.stdn bit = 1 (start condition detection). reset sets this register to 00h. after reset: 00h r/w address: sva0 fffffd83h, sva1 fffffd93h, sva2 fffffda3h 7 6 5 4 3 2 1 0 svan 0 (n = 0 to 2)
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 574 17.5 i 2 c bus mode functions 17.5.1 pin configuration the serial clock pin (scl0n) and serial data bus pin (sda0n) are configured as follows (n = 0 to 2). scl0n ................th is pin is used for serial clock input and output. this pin is an n-ch open-drain output for both ma ster and slave devices. input is schmitt input. sda0n ................th is pin is used for serial data input and output. this pin is an n-ch open-drain output for both ma ster and slave devices. input is schmitt input. since outputs from the serial clock line and the serial dat a bus line are n-ch open-drain outputs, an external pull-up resistor is required. figure 17-6. pin configuration diagram v dd scl0n sda0n scl0n sda0n v dd clock output master device (clock input) data output data input (clock output) clock input data output data input slave device
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 575 17.6 i 2 c bus definitions and control methods the following section describes the i 2 c bus's serial data communication format and the signals used by the i 2 c bus. the transfer timing for the "start condition", "address", "tr ansfer direction specification" , "data", and "stop condition" generated on the i 2 c bus's serial data bus is shown below. figure 17-7. i 2 c bus serial data transfer timing 1 to 7 8 9 1 to 8 9 1 to 8 9 scl0n sda0n r/w start condition address ack data data stop condition ack ack the master device generates the start condition, slave address, and stop condition. ack can be generated by either the master or slave device (normally, it is generated by the devic e that receives 8- bit data). the serial clock (scl0n) is continuous ly output by the master device. however, in t he slave device, the scl0n pin's low-level period can be extended and a wa it state can be inserted (n = 0 to 2). 17.6.1 start condition a start condition is met when the scl0n pin is high level and the sda0n pin changes from high level to low level. the start condition for the scl0n and sda0n pins is a signal t hat the master device output s to the slave device when starting a serial transfer. the slave device can defect the start condition (n = 0 to 2). figure 17-8. start condition h scl0n sda0n a start condition is output when the iiccn.sttn bit is se t (1) after a stop condition has been detected (iicsn.spdn bit = 1). when a start condition is detected, the iicsn.stdn bit is set (1) (n = 0 to 2). caution when the iiccn.iicen bit of the v850es/jj2 is set to 1 while communications with other devices are in progress, the start condition may be detected depending on the status of the communication line. be sure to set the iiccn.iicen bit to 1 wh en the scl0n and sda0n lines are high level.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 576 17.6.2 addresses the 7 bits of data that follow the st art condition are defined as an address. an address is a 7-bit data segment that is output in order to select one of t he slave devices that are connected to the master device via the bus lines. therefore, each slave device connect ed via the bus lines must have a unique address. the slave devices include hardware that detects the start condition and chec ks whether or not the 7-bit address data matches the data values stored in t he svan register. if the address data matc hes the values of the svan register, the slave device is selected and communicates with the ma ster device until the master device generates a start condition or stop condition (n = 0 to 2). figure 17-9. address address scl0n 1 sda0n intiicn note 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w note the interrupt request signal (int iicn) is generated if a local addre ss or extension code is received during slave device operation. remark n = 0 to 2 the slave address and the eighth bit, which specif ies the transfer direction as described in 17.6.3 transfer direction specification below, are written together to iic shift regi ster n (iicn) and then out put. received addresses are written to the iicn register (n = 0 to 2). the slave address is assigned to the hi gher 7 bits of the iicn register.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 577 17.6.3 transfer dir ection specification in addition to the 7-bit address data, the master device sends 1 bit that specif ies the transfer direction. when this transfer direction specification bit has a value of 0, it indicates that the mast er device is transmitting data to a slave device. when the transfer direction specification bit has a val ue of 1, it indicates that t he master device is receiving data from a slave device. figure 17-10. transfer direction specification scl0n 1 sda0n intiicn 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w transfer direction specification note note the intiicn signal is generated if a local address or extension code is re ceived during slave device operation. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 578 17.6.4 ack ack is used to confirm the serial data stat us of the transmitting and receiving devices. the receiving device returns ack for every 8 bits of data it receives. the transmitting device normally receives ack after transmi tting 8 bits of data. when ack is returned from the receiving device, the reception is j udged as normal and processing continues. t he detection of ack is confirmed with the iicsn.ackdn bit. when the master device is the receivi ng device, after receiving the final dat a, it does not return ack and generates the stop condition. when the slave dev ice is the receiving device and does not return ack, the master device generates either a stop condition or a rest art condition, and then stops the current transmission. failure to return ack may be caused by the following factors. (a) reception was not performed normally. (b) the final data was received. (c) the receiving device (slave) does not exist for the specified address. when the receiving device sets the sda0n line to low level during the ninth clo ck, ack is generated (normal reception). when the iiccn.acken bit is set to 1, automatic ac k generation is enabled. trans mission of the eighth bit following the 7 address data bits causes the iicsn.trcn bit to be set. normally, set the acken bit to 1 for reception (trcn bit = 0). when the slave device is receiving (when trcn bit = 0), if the slave device cannot rece ive data or does not need to receive any more data, clear the acken bit to 0 to indi cate to the master that no more data can be received. similarly, when the master device is receiving (when trcn bit = 0) and the subsequent data is not needed, clear the acken bit to 0 to prevent ack from being generated. th is notifies the slave device (transmitting device) of the end of the data transmissi on (transmission stopped). figure 17-11. ack scl0n 1 sda0n 23456789 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r/w ack remark n = 0 to 2 when the local address is received, ack is automatically generated regardless of the value of the acken bit. no ack is generated if the received addre ss is not a local address (nack). when receiving the extension code, set the acken bit to 1 in advance to generate ack. the ack generation method during data rec eption is based on the wait timing setti ng, as described by the following. ? when 8-clock wait is selected (iiccn.wtimn bit = 0): ack is generated at the falling edge of t he scl0n pin's eighth clock if the acken bit is set to 1 before the wait state cancellation. ? when 9-clock wait is selected (iiccn.wtimn bit = 1): ack is generated if the acken bit is set to 1 in advance. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 579 17.6.5 stop condition when the scl0n pin is high level, changing the sda0n pin fr om low level to high level generates a stop condition (n = 0 to 2). a stop condition is generated when serial transfer from the ma ster device to the slave device has been completed. when used as the slave device, t he start condition can be detected. figure 17-12. stop condition h scl0n sda0n remark n = 0 to 2 a stop condition is generated when the ii ccn.sptn bit is set to 1. when the stop condition is detected, the iicsn.spdn bit is set to 1 and the interrupt request signal (i ntiicn) is generated when the ii ccn.spien bit is set to 1 (n = 0 to 2).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 580 17.6.6 wait state a wait state is used to notify the comm unication partner that a device (master or slave) is preparing to transmit or receive data (i.e., is in a wait state). setting the scl0n pin to low level notifies the communication partner of the wait state. when the wait state has been canceled for both the master and slave devices, the next data transfer can begin (n = 0 to 2). figure 17-13. wait state (1/2) (a) when master device has a nine-clock wa it and slave device has an eight-clock wait (master: transmission, slave: recep tion, and iiccn.acken bit = 1) scl0n 6 sda0n 78 9 123 scl0n iicn 6 h 78 123 d2 d1 d0 ack d7 d6 d5 9 iicn scl0n acken master master returns to high impedance but slave is in wait state (low level). wait after output of ninth clock. iicn data write (cancel wait state) slave wait after output of eighth clock. ffh is written to iicn register or iiccn.wreln bit is set to 1. transfer lines wait state from slave wait state from master remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 581 figure 17-13. wait state (2/2) (b) when master and slave d evices both have a nine-clock wait (master: transmission, slave: reception, and acken bit = 1) scl0n 6 sda0n 789 123 scl0n iicn 6 h 78 1 23 d2 d1 d0 ack d7 d6 d5 9 iicn scl0n acken master master and slave both wait after output of ninth clock. iicn data write (cancel wait state) slave ffh is written to iicn register or wreln bit is set to 1. generated according to previously set acken bit value transfer lines wait state from master/ slave wait state from slave remark n = 0 to 2 a wait state may be automatically generated depending on the setting of the iiccn.wtimn bit (n = 0 to 2). normally, when the iiccn.wreln bit is set to 1 or when ffh is written to the iicn register on the receiving side, the wait state is canceled and the trans mitting side writes data to the iicn regi ster to cancel the wait state. the master device can also cancel the wait state via either of the following methods. ? by setting the iiccn.sttn bit to 1 ? by setting the iiccn.sptn bit to 1
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 582 17.6.7 wait state cancellation method in the case of i 2 c0n, wait state can be canceled normally in the following ways (n = 0 to 2). ? by writing data to the iicn register ? by setting the iiccn.wreln bit to 1 (wait state cancellation) ? by setting the iiccn.sttn bit to 1 (start condition generation) ? by setting the iiccn.sptn bit to 1 (stop condition generation) if any of these wait state canc ellation actions is performed, i 2 c0n will cancel wait state and restart communication. when canceling wait state and s ending data (including address), writ e data to the iicn register. to receive data after canceling wait state, or to complete data transmission, set the wreln bit to 1. to generate a restart condition after canceli ng wait state, set the sttn bit to 1. to generate a stop condition after canceling wait state, set the sptn bit to 1. execute cancellation only once for each wait state. for example, if data is written to t he iicn register following wait state canc ellation by setting the wreln bit to 1, conflict between the sdan line change timing and iicn register write timing may resu lt in the data output to the sdan line may be incorrect. even in other operations, if communication is stopped halfway, clearing the iiccn.iicen bit to 0 will stop communication, enabling wait state to be cancelled. if the i 2 c bus dead-locks due to noise, etc., setting the iiccn.lre ln bit to 1 causes the communication operation to be exited, enabling wait st ate to be cancelled.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 583 17.7 i 2 c interrupt request signals (intiicn) the following shows the value of the iic sn register at the intiicn interr upt request signal generation timing and at the intiicn signal timing (n = 0 to 2). 17.7.1 master device operation (1) start ~ address ~ data ~ data ~ stop (normal transmission/reception) <1> when iiccn.wtimn bit = 0 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b s 3: iicsn register = 1000x000b (wtimn bit = 1) s 4: iicsn register = 1000xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x100b s 3: iicsn register = 1000xx00b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 584 (2) start ~ address ~ data ~ star t ~ address ~ data ~ stop (restart) <1> when wtimn bit = 0 sttn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 s 6 ? 7 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000xx00b (wtimn bit = 0) s 4: iicsn register = 1000x110b (wtimn bit = 0) s 5: iicsn register = 1000x000b (wtimn bit = 1) s 6: iicsn register = 1000xx00b ? 7: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 sttn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b s 3: iicsn register = 1000x110b s 4: iicsn register = 1000xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 585 (3) start ~ code ~ data ~ data ~ stop (extension code transmission) <1> when wtimn bit = 0 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 1010x110b s 2: iicsn register = 1010x000b s 3: iicsn register = 1010x000b (wtimn bit = 1) s 4: iicsn register = 1010xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 1010x110b s 2: iicsn register = 1010x100b s 3: iicsn register = 1010xx00b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 586 17.7.2 slave device operation (when recei ving slave address data (address match)) (1) start ~ address ~ data ~ data ~ stop <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x000b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when iiccn.spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x100b s 3: iicsn register = 0001xx00b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 587 (2) start ~ address ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001x000b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 588 (3) start ~ address ~ data ~ start ~ code ~ data ~ stop <1> when wtimn bit = 0 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x000b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 ? 6 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x110b s 5: iicsn register = 0010xx00b ? 6: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 589 (4) start ~ address ~ data ~ start ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001x000b s 3: iicsn register = 00000x10b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0001x110b s 2: iicsn register = 0001xx00b s 3: iicsn register = 00000x10b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 590 17.7.3 slave device operation (w hen receiving extension code) (1) start ~ code ~ data ~ data ~ stop <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x000b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when iiccn.spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010x100b s 4: iicsn register = 0010xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 591 (2) start ~ code ~ data ~ st art ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0001x110b s 4: iicsn register = 0001x000b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address match) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 ? 6 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 0001x110b s 5: iicsn register = 0001xx00b ? 6: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 592 (3) start ~ code ~ data ~ st art ~ code ~ data ~ stop <1> when wtimn bit = 0 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x010b s 4: iicsn register = 0010x000b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, extension code reception) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 s 5 s 6 ? 7 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 0010x010b s 5: iicsn register = 0010x110b s 6: iicsn register = 0010xx00b ? 7: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 593 (4) start ~ code ~ data ~ st art ~ address ~ data ~ stop <1> when wtimn bit = 0 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x000b s 3: iicsn register = 00000x10b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 (after restart, address mismatch (= not extension code)) st ad6 to ad0 r/w ack d7 to d0 ack st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0010x010b s 2: iicsn register = 0010x110b s 3: iicsn register = 0010xx00b s 4: iicsn register = 00000x10b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 594 17.7.4 operation without communication (1) start ~ code ~ data ~ data ~ stop st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp ? 1 ? 1: iicsn register = 00000001b remarks 1. ? : generated only when spien bit = 1 2. n = 0 to 2 17.7.5 arbitration loss operation (opera tion as slave after arbitration loss) (1) when arbitration loss occurs duri ng transmission of slave address data <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0101x110b (example: when iicsn .aldn bit is read during interrupt servicing) s 2: iicsn register = 0001x000b s 3: iicsn register = 0001x000b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when iiccn.spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0101x110b (example: when aldn bit is read during in terrupt servicing) s 2: iicsn register = 0001x100b s 3: iicsn register = 0001xx00b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 595 (2) when arbitration loss occurs dur ing transmission of extension code <1> when wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 0110x010b (example: when al dn bit is read during interrupt servicing) s 2: iicsn register = 0010x000b s 3: iicsn register = 0010x000b ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 0110x010b (example: when al dn bit is read during interrupt servicing) s 2: iicsn register = 0010x110b s 3: iicsn register = 0010x100b s 4: iicsn register = 0010xx00b ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 596 17.7.6 operation when arbitrat ion loss occurs (no communicat ion after arbitration loss) (1) when arbitration loss occurs dur ing transmission of slave address data st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 ? 2 s 1: iicsn register = 01000110b (example: when iicsn.a ldn bit is read during interrupt servicing) ? 2: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when iiccn.spien bit = 1 2. n = 0 to 2 (2) when arbitration loss occurs during transmission of extension code st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 ? 2 s 1: iicsn register = 0110x010b (example: when al dn bit is read during interrupt servicing) iiccn.lreln bit is set to 1 by software ? 2: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 597 (3) when arbitration loss o ccurs during data transfer <1> when iiccn.wtimn bit = 0 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 ? 3 s 1: iicsn register = 10001110b s 2: iicsn register = 01000000b (example: when aldn bit is read during in terrupt servicing) ? 3: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 2. n = 0 to 2 <2> when wtimn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 ? 3 s 1: iicsn register = 10001110b s 2: iicsn register = 01000100b (example: when aldn bit is read during in terrupt servicing) ? 3: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 598 (4) when arbitration loss occurs due to restart condition duri ng data transfer <1> not extension code (example: address mismatch) st ad6 to ad0 r/w ack d7 to dn st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 ? 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 01000110b (example: when aldn bit is read during in terrupt servicing) ? 3: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. dn = d6 to d0 n = 0 to 2 <2> extension code st ad6 to ad0 r/w ack d7 to dn st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 ? 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 0110x010b (example: when al dn bit is read during interrupt servicing) iiccn.lreln bit is set to 1 by software ? 3: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. dn = d6 to d0 n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 599 (5) when arbitration loss occurs due to stop condition during data transfer st ad6 to ad0 r/w ack d7 to dn sp s 1 ? 2 s 1: iicsn register = 1000x110b ? 2: iicsn register = 01000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. dn = d6 to d0 n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 600 (6) when arbitration loss occurs due to low level of sda0n pin when attempting to generate a restart condition <1> when wtimn bit = 0 iiccn.sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000xx00b (wtimn bit = 0) s 4: iicsn register = 01000000b (example: when aldn bit is read during in terrupt servicing) ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 iiccn.sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b s 3: iicsn register = 01000100b (example: when aldn bit is read during in terrupt servicing) ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 601 (7) when arbitration loss occurs due to a stop conditi on when attempting to gene rate a restart condition <1> when wtimn bit = 0 sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000xx00b ? 4: iicsn register = 01000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 sttn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack sp s 1 s 2 ? 3 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b ? 3: iicsn register = 01000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 602 (8) when arbitration loss occurs due to low level of sda0n pin wh en attempting to generate a stop condition <1> when wtimn bit = 0 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 s 4 ? 5 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000x000b (wtimn bit = 1) s 3: iicsn register = 1000xx00b (wtimn bit = 0) s 4: iicsn register = 01000000b (example: when aldn bit is read during in terrupt servicing) ? 5: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2 <2> when wtimn bit = 1 iiccn.sptn bit = 1 st ad6 to ad0 r/w ack d7 to d0 ack d7 to d0 ack d7 to d0 ack sp s 1 s 2 s 3 ? 4 s 1: iicsn register = 1000x110b s 2: iicsn register = 1000xx00b s 3: iicsn register = 01000000b (example: when aldn bit is read during in terrupt servicing) ? 4: iicsn register = 00000001b remarks 1. s : always generated ? : generated only when spien bit = 1 x: don't care 2. n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 603 17.8 interrupt request signal (intiicn) generation timing and wait control the setting of the iiccn.wtimn bit determines the timi ng by which the intiicn r egister is generated and the corresponding wait control, as shown below (n = 0 to 2). table 17-3. intiicn genera tion timing and wait control during slave device operation du ring master device operation wtimn bit address data reception data transmission address data reception data transmission 0 9 notes 1, 2 8 note 2 8 note 2 9 8 8 1 9 notes 1, 2 9 note 2 9 note 2 9 9 9 notes 1. the slave device's intiicn signal and wait period occur at the falli ng edge of the ninth clock only when there is a match with the addre ss set to the svan register. at this point, ack is generated regardless of the va lue set to the iiccn.acken bit. for a slave device that has received an extension code, the intiicn signal occurs at t he falling edge of the eighth clock. when the address does not match after restart, the intiicn signal is generated at the falling edge of the ninth clock, but no wait occurs. 2. if the received address does not ma tch the contents of the svan regi ster and an extension code is not received, neither the intiicn signal nor a wait state is generated. remarks 1. the numbers in the table indicate the number of the serial clock's clock signals. interrupt requests and wait control are both synchronized wit h the falling edge of these clock signals. 2. n = 0 to 2 (1) during address transmission/reception ? slave device operation: interrupt and wait ti ming are determined regardless of the wtimn bit. ? master device operation: interrupt and wait timing occur at the falling edge of the ninth clock regardless of the wtimn bit. (2) during data reception ? master/slave device operation: interrupt and wait timing is determined according to the wtimn bit. (3) during data transmission ? master/slave device operation: interrupt and wait timing is determined according to the wtimn bit.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 604 (4) wait state cancellation method the four wait state cancella tion methods are as follows. ? by setting the iiccn.wreln bit to 1 ? by writing to the iicn register ? by start condition setting (iiccn.sttn bit = 1) note ? by stop condition setting (iiccn.sptn bit = 1) note note master only when an 8-clock wait has been selected (wtimn bit = 0), whether or not ac k has been generated must be determined prior to wait cancellation. remark n = 0 to 2 (5) stop condition detection the intiicn signal is generated w hen a stop condition is detected. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 605 17.9 address match detection method in i 2 c bus mode, the master dev ice can select a particular slave devic e by transmitting the corresponding slave address. address match detection is performed aut omatically by hardware. the int iicn signal occurs when a local address has been set to the svan register and when the address set to the svan register matches the slave address sent by the master device, or when an extensi on code has been received (n = 0 to 2). 17.10 error detection in i 2 c bus mode, the status of the serial data bus pin (sda0n) during data transmission is captured by the iicn register of the transmitting device, so the data of the iicn regi ster prior to transmissi on can be compared with the transmitted iicn data to enable detection of transmission erro rs. a transmission error is judged as having occurred when the compared data values do not match (n = 0 to 2). 17.11 extension code (1) when the higher 4 bits of the receive address are either 0000 or 1111, the ext ension code flag (iicsn.excn bit) is set for extension code reception and an interrupt request signal (intiicn) is issued at the falling edge of the eighth clock (n = 0 to 2). the local address stored in the svan register is not affected. (2) if 11110xx0 is set to the svan register by a 10- bit address transfer and 11110xx0 is transferred from the master device, the results are as fo llows. note that the intiicn signal occurs at the falling edge of the eighth clock (n = 0 to 2). ? higher four bits of data match: excn bit = 1 ? seven bits of data match: iicsn.coin bit = 1 (3) since the processing after the interrupt request signal occurs differs according to the data that follows the extension code, such processi ng is performed by software. for example, when operation as a sl ave is not desired after the ext ension code is received, set the iiccn.lreln bit to 1 and the cpu will enter the next communication wait state. table 17-4. extension code bit definitions slave address r/w bit description 0000 000 0 general call address 0000 000 1 start byte 0000 001 x cbus address 0000 010 x address that is reserved for different bus format 1111 0xx x 10-bit slave address specification
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 606 17.12 arbitration when several master devices simultaneous ly generate a start condition (when the iiccn.sttn bit is set to 1 before the iicsn.stdn bit is set to 1), communication between the ma ster devices is performed wh ile the number of clocks is adjusted until the data differs. this kind of oper ation is called arbitration (n = 0 to 2). when one of the master devices loses in arbitration, an arbitration loss flag ( iicsn.aldn bit) is set to 1 via the timing by which the arbitration loss occurred, and the scl0n and sda0n lines are both set to high impedance, which releases the bus (n = 0 to 2). arbitration loss is detected based on t he timing of the next interrupt request signal (intiicn) (the eighth or ninth clock, when a stop condition is det ected, etc.) and the setting of the aldn bit to 1, which is made by software (n = 0 to 2). for details of interrupt request timing, see 17.7 i 2 c interrupt request signals (intiicn) . figure 17-14. arbitration timing example master 1 master 2 transfer lines scl0n sda0n scl0n sda0n scl0n sda0n master 1 loses arbitration hi-z hi-z remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 607 table 17-5. status during arbitration a nd interrupt request si gnal generation timing status during arbitration inte rrupt request generation timing transmitting address transmission read/write data after address transmission transmitting extension code read/write data after extension code transmission transmitting data ack transfer period after data reception when restart condition is det ected during data transfer at falling edge of eighth or ninth clock following byte transfer note 1 when stop condition is detected duri ng data transfer when stop condition is generated (when iiccn.spien bit = 1) note 2 when sda0n pin is low level while attempting to generate restart condition at falling edge of eighth or ninth clock following byte transfer note 1 when stop condition is detected while attempting to generate restart condition when stop condition is generated (when iiccn.spien bit = 1) note 2 when dsa0n pin is low level while attempting to generate stop condition when scl0n pin is low level while attempting to generate restart condition at falling edge of eighth or ninth clock following byte transfer note 1 notes 1. when the iiccn.wtimn bit = 1, an intiicn signal o ccurs at the falling edge of the ninth clock. when the wtimn bit = 0 and the extension code's slave address is received, an intiicn signal occurs at the falling edge of the eighth clock (n = 0 to 2). 2. when there is a possibility that arbitration will occur, set the spien bit to 1 for master device operation (n = 0 to 2). 17.13 wakeup function the i 2 c bus slave function is a function that generates an interrupt request si gnal (intiicn) when a local address and extension code have been received. this function makes processing more efficient by prev enting unnecessary the intiicn signal from occurring when addresses do not match. when a start condition is detected, wa keup standby mode is set. this wak eup standby mode is in effect while addresses are transmitted due to the possi bility that an arbitration loss may change the master device (which has generated a start condition) to a slave device. however, when a stop condition is detect ed, the iiccn.spien bit is set regardl ess of the wakeup function, and this determines whether intiicn signal is enabled or disabled (n = 0 to 2).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 608 17.14 communication reservation 17.14.1 when communication reservation functi on is enabled (iicfn.iicrsvn bit = 0) to start master device communications when not current ly using the bus, a communication reservation can be made to enable transmission of a start condition when the bus is released. there are two modes in which the bus is not used. ? when arbitration results in neit her master nor slave operation ? when an extension code is received and slave operation is disabled (ack is not returned and the bus was released when the iiccn.lreln bit was set to 1) (n = 0 to 2). if the iiccn.sttn bit is set to 1 while the bus is not used, a start condition is aut omatically generated and a wait state is set after the bus is releas ed (after a stop condition is detected). when the bus release is detected (when a stop condition is detected), writing to the iicn register causes master address transfer to start. at this point, the ii ccn.spien bit should be set to 1 (n = 0 to 2). when sttn has been set to 1, the operation mode (as st art condition or as communication reservation) is determined according to the bus status (n = 0 to 2). if the bus has been re leased .............................................a start condition is generated if the bus has not been released (standby mode)..............comm unication reservation to detect which operation mode has been det ermined for the sttn bit, set the sttn bit to 1, wait for the wait period, then check the iicsn.mstsn bit (n = 0 to 2). the wait periods, which should be set via software, are list ed in table 17-6. these wait periods can be set by the smcn, cln1, and cln0 bits of the iiccln regi ster and the iicxn.clxn bit (n = 0 to 2).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 609 table 17-6. wait periods clock selection clxn smcn cln1 cln0 wait period f xx (when ocksm = 18h set) 0 0 0 0 26 clocks f xx /2 (when ocksm = 10h set) 0 0 0 0 52 clocks f xx /3 (when ocksm = 11h set) 0 0 0 0 78 clocks f xx /4 (when ocksm = 12h set) 0 0 0 0 104 clocks f xx /5 (when ocksm = 13h set) 0 0 0 0 130 clocks f xx (when ocksm = 18h set) 0 0 0 1 47 clocks f xx /2 (when ocksm = 10h set) 0 0 0 1 94 clocks f xx /3 (when ocksm = 11h set) 0 0 0 1 141 clocks f xx /4 (when ocksm = 12h set) 0 0 0 1 188 clocks f xx 0 0 1 0 47 clocks f xx (when ocksm = 18h set) 0 1 0 16 clocks f xx /2 (when ocksm = 10h set) 0 1 0 32 clocks f xx /3 (when ocksm = 11h set) 0 1 0 48 clocks f xx /4 (when ocksm = 12h set) 0 1 0 64 clocks f xx 0 1 1 0 16 clocks f xx (when ocksm = 18h set) 1 1 0 10 clocks f xx /2 (when ocksm = 10h set) 1 1 0 20 clocks f xx /3 (when ocksm = 11h set) 1 1 0 30 clocks f xx /4 (when ocksm = 12h set) 1 1 0 40 clocks f xx 1 1 1 0 10 clocks remarks 1. n = 0 to 2 m = 0, 1 2. = don't care the communication reservation timing is shown below.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 610 figure 17-15. communication reservation timing 2 1 3456 2 1 3456 789 scl0n sda0n program processing hardware processing write to iicn set spdn and intiicn sttn = 1 communication reservation set stdn generated by master with bus access remark n = 0 to 2 sttn: bit of iiccn register stdn: bit of iicsn register spdn: bit of iicsn register communication reservations are accepted via the following timing. after the iicsn.stdn bit is set to 1, a communication reservation can be made by setting the iiccn.s ttn bit to 1 before a stop condition is detected (n = 0 to 2). figure 17-16. timing for accep ting communication reservations scl0n sda0n stdn spdn standby mode remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 611 the communication reservation flowchart is illustrated below. figure 17-17. communication reservation flowchart di set1 sttn define communication reservation wait cancel communication reservation no yes iicn register xxh ei mstsn bit = 0? (communication reservation) note (generate start condition) sets sttn bit (communication reservation). secures wait period set by software (see table 17-6 ). confirmation of communication reservation clears user flag. iicn register write operation defines that communication reservation is in effect (defines and sets user flag to any part of ram). note the communication reservation operation execut es a write to the iic n register when a stop condition interrupt request occurs. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 612 17.14.2 when communication reservation functi on is disabled (iicfn.iicrsvn bit = 1) when the iiccn.sttn bit is set when the bus is not us ed in a communication during bus communication, this request is rejected and a start condition is not generated. there are two modes in wh ich the bus is not used. ? when arbitration results in nei ther master nor slave operation ? when an extension code is received and slave operation is disabled (ack is not returned and the bus was released when the iiccn.lreln bit was set to 1) (n = 0 to 2). to confirm whether the start conditi on was generated or request was rejected, check the iicfn.stcfn flag. the time shown in table 17-7 is required until the stcfn flag is set after setting the sttn bit to 1. therefore, secure the time by software. table 17-7. wait periods ocksenm ocksm1 ocksm0 cln1 cln0 wait period 1 0 0 0 6 clocks 1 0 1 0 9 clocks 1 1 0 0 12 clocks 1 1 1 0 15 clocks 0 0 0 1 0 3 clocks remarks 1. : don't care 2. n = 0 to 2 m = 0, 1
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 613 17.15 cautions (1) when iicfn.stcenn bit = 0 immediately after the i 2 c0n operation is enabled, the bus communica tion status (iicfn.iicbsyn bit = 1) is recognized regardless of the actual bus status. to execute master comm unication in the status where a stop condition has not been detect ed, generate a stop condition and then releas e the bus before st arting the master communication. use the following sequence for generating a stop condition. <1> set the iiccln register. <2> set the iiccn.iicen bit. <3> set the iiccn.sptn bit. (2) when iicfn.stcenn bit = 1 immediately after i 2 c0n operation is enabled, the bus released st atus (iicbsyn bit = 0) is recognized regardless of the actual bus status. to generate the first start condition (iiccn.sttn bit = 1), it is necessary to confirm that the bus has been released, so as to not disturb other communications. (3) when the iiccn.iicen bit of the v850es/jj2 is set to 1 while communications with other devices are in progress, the start condition may be detected depending on the status of the communication line. be sure to set the iiccn.iicen bit to 1 when the scl0n and sda0n lines are high level. (4) determine the operation clock frequency by the ii ccln, iicxn, and ocksm registers before enabling the operation (iiccn.iicen bit = 1). to change the operation clock frequency, clear the iiccn.iicen bit to 0 once. (5) after the iiccn.sttn and iiccn.sptn bits have been set to 1, they must not be re -set without being cleared to 0 first. (6) if transmission has been reserved, set the iiccn.spien bit to 1 so that an interrupt request is generated by the detection of a stop condition. after an interrupt r equest has been generated, the wait state will be released by writing communication data to i 2 cn, then transferring will begin. if an interrupt is not generated by the detection of a stop condition, transmission will hal t in the wait state because an in terrupt request was not generated. however, it is not necessary to set the spien bit to 1 for the software to detect the iicsn.mstsn bit. remark n = 0 to 2 m = 0, 1
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 614 17.16 communication operations remark set the p38, p39, p40, p 41, p90, and p91 pins to i 2 c mode (sda0n, scl0n) referencing table 4-19 using port pin as alternate-function pin , before starting communication (n = 0 to 2). 17.16.1 master operation 1 the following shows the flowchart for master communi cation when the communication reservation function is enabled (iicfn.iicrsvn bit = 0) and the master operation is started after a stop c ondition is detected (iicfn.stcenn bit = 0).
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 615 figure 17-18. master operation flowchart (1) iiccn h iicen = spien = wtimn = sptn = 1 iiccln h select transfer clock sttn = 1 start acken = 0 no no no no no no no no no yes yes yes yes yes yes yes intiicn = 1? wtimn = 0 acken = 1 intiicn = 1? intiicn = 1? trcn = 1? ackdn = 1? mstsn = 1? yes no intiicn = 1? intiicn = 1? ackdn = 1? wreln = 1 start reception yes (stop condition detection) wait wait time is secured by software (see table 17-6 ) yes (start condition generation) communication reservation start iicn write transfer stop condition detection, start condition generation by communication reservation generate stop condition (no slave with matching address) no (receive) address transfer completion yes (transmit) end start iicn write transfer data processing transfer completed? generate stop condition sptn = 1 (restart) end transfer completed? data processing remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 616 17.16.2 master operation 2 the following shows the flowchart for master communi cation when the communication reservation function is disabled (iicrsvn bit = 1) and the master operation is started without detec ting a stop condition (stcenn bit = 1). figure 17-19. master operation flowchart (2) no (receive) iiccln h iicfn h iiccn h iicen = spien = wtimn = 1 sttn = 1 start no yes iicbsyn = 0? no yes wtimn = 0 acken = 1 wreln = 1 start reception acken = 0 sptn = 1 generate stop condition no yes yes (transmit) intiicn = 1? no yes yes intiicn = 1? no yes intiicn = 1? no yes ackdn = 1? no yes no ackdn = 1? trcn = 1? stcfn = 0? end transfer clock selection iicfn register setting iiccn register initial setting wait time is secured by software (see table 17-7 ) insert wait state start iicn write transfer stop master communication master communication is stopped because bus is occupied yes (address transfer completion) start iicn write transfer generate stop condition (no slave with matching address) end data processing data processing reception completed? transfer completed? (restart) remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 617 17.16.3 slave operation the following shows the processing procedure of the slave operation. basically, the operation of the slave device is event-dri ven. therefore, processing by an intiicn interrupt (processing requiring a significant change of the operat ion status, such as stop condition detection during communication) is necessary. the following description assumes that data communication does not support extension codes. also, it is assumed that the intiicn interrupt servicing performs only status change processing and t hat the actual data communication is performed during the main processing. figure 17-20. software out line during slave operation i 2 c intiicn signal setting, etc. setting, etc. flag data main processing interrupt servicing therefore, the following three flags are prepared so that the data trans fer processing can be performed by transmitting these flags to the main processing instead of intiicn signal. (1) communication mode flag this flag indicates the following communication statuses. clear mode: data communication not in progress communication mode: data communication in progress (valid address detection stop condition detection, ack from master not detected, address mismatch) (2) ready flag this flag indicates that data communication is enabled. th is is the same status as an intiicn interrupt during normal data transfer. this flag is set in the interrupt processing block and cleared in the main processing block. the ready flag for the first data for transmission is not set in the interrupt processing bl ock, so the first data is transmitted without clear processing (the address ma tch is regarded as a request for the next data). (3) communication direction flag this flag indicates the direction of communication and is the same as the value of iicsn.trcn bit. the following shows the operation of the main processing block during slave operation. start i 2 c0n and wait for the communication enabled status. when communication is enabled, perform transfer using the communication mode flag and ready flag (the pr ocessing of the stop condition and start condition is performed by interrupts, conditions are confirmed by flags). for transmission, repeat the transmission operation until the master device stops returning ack. when the master device stops returning ack , transfer is complete.
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 618 for reception, receive the required number of data and do not return ack for the next data immediately after transfer is complete. after that, the master device generates the stop condition or restart c ondition. this causes exit from communications. figure 17-21. slave operation flowchart (1) yes yes yes yes no yes yes yes no no no no yes no no no start communication mode? communication mode? communication mode? ready? ready? read data clear ready flag clear ready flag communication direction flag = 1? wtimn = 1 wreln = 1 acken = 0 wreln = 1 acken = wtimn = 1 ackdn = 1? wreln = 1 clear communication mode flag data processing data processing transfer completed? iicn data iiccn xxh iicen = 1 iiccln xxh iicfn xxh selection of transfer flag iicfn register setting remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 619 the following shows an example of the proc essing of the slave device by an int iicn interrupt (it is assumed that no extension codes are used here). during an intiicn interr upt, the status is confirm ed and the following steps are executed. <1> when a stop condition is detect ed, communication is terminated. <2> when a start condition is detected, the address is confirmed. if the address does not match, communication is terminated. if the address matches, the communi cation mode is set and wait state is released, and operation returns from the interr upt (the ready flag is cleared). <3> for data transmission/reception, w hen the ready flag is set, operation retu rns from the interrupt while the i 2 c0n bus remains in the wait state. remark <1> to <3> in the above correspond to <1> to <3> in figure 17-22 slave operation flowchart (2) . figure 17-22. slave operation flowchart (2) yes yes yes no no no intiicn generated set ready flag interrupt servicing completed interrupt servicing completed interrupt servicing completed termination processing spdn = 1? stdn = 1? coin = 1? lreln = 1 clear communication mode communication direction flag trcn set communication mode flag clear ready flag <1> <2> <3> remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 620 17.17 timing of data communication when using i 2 c bus mode, the master device out puts an address via the serial bus to select one of several slave devices as its communication partner. after outputting the slave address, t he master device transmits the iicsn .trcn bit, which specifies the data transfer direction, and then starts seri al communication with the slave device. the shift operation of the iicn register is synchronized with the falling edge of the serial clock pin (scl0n). the transmit data is transferred to the so latch and is output (msb first) via the sda0n pin. data input via the sda0n pin is captured by the iicn register at the ri sing edge of the scl0n pin. the data communication timing is shown below. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 621 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (1/3) (a) start condition ~ address iicn ackdn stdn spdn wtimn h h l l l l h h h l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 123456789 4 3 2 1 ad6 ad5 ad4 ad3 ad2 ad1 ad0 w ack d4 d5 d6 d7 iicn address iicn data iicn ffh transmit start condition receive (when excn = 1) note note note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 622 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (2/3) (b) data iicn ackdn stdn spdn wtimn h h l l l l l l h h h h l l l l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 1 9 8 23456789 3 2 1 d7 d0 d6 d5 d4 d3 d2 d1 d0 d5 d6 d7 iicn data iicn ffh note iicn ffh note iicn data transmit receive note note note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 623 figure 17-23. example of m aster to slave communication (when 9-clock wait is selected for both master and slave) (3/3) (c) stop condition iicn ackdn stdn spdn wtimn h h l l l l h h h l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 123456789 2 1 d7 d6 d5 d4 d3 d2 d1 d0 ad5 ad6 iicn data iicn address iicn ffh note iicn ffh note stop condition start condition transmit note note (when spien = 1) receive (when spien = 1) note to cancel slave wait, write ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 624 figure 17-24. example of sl ave to master communication (when 9-clock wait is selected for both master and slave) (1/3) (a) start condition ~ address iicn ackdn stdn spdn wtimn h h l l h h l acken mstsn sttn l l sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 123456789 4 56 3 2 1 ad6 ad5 ad4 ad3 ad2 ad1 ad0 r d4 d3 d2 d5 d6 d7 iicn address iicn ffh note note iicn data start condition note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 625 figure 17-24. example of sl ave to master communication (when 9-clock wait is selected for both master and slave) (2/3) (b) data iicn ackdn stdn spdn wtimn h h h l l l l l l h h h l l l l l acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 1 89 23456789 3 2 1 d7 d0 ack d6 d5 d4 d3 d2 d1 d0 ack d5 d6 d7 note note receive transmit iicn data iicn data iicn ffh note iicn ffh note note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
chapter 17 i 2 c bus preliminary user's manual u17714ej1v0ud 626 figure 17-24. example of sl ave to master communication (when 9-clock wait is selected for both master and slave) (3/3) (c) stop condition iicn ackdn stdn spdn wtimn h h l l l h acken mstsn sttn sptn wreln intiicn trcn iicn ackdn stdn spdn wtimn acken mstsn sttn sptn wreln intiicn trcn scl0n sda0n processing by master device transfer lines processing by slave device 123456789 2 1 d7 d6 d5 d4 d3 d2 d1 d0 ad5 ad6 iicn address iicn ffh note note iicn data stop condition start condition (when spien = 1) nack (when spien = 1) note to cancel master wait, writ e ffh to iicn or set wreln. remark n = 0 to 2
preliminary user's manual u17714ej1v0ud 627 chapter 18 dma function (dma controller) the v850es/jj2 includes a direct memory access (dma) controller (dmac) that ex ecutes and controls dma transfer. the dmac controls data transfer between memory and i/o, between memo ries, or between i/os based on dma requests issued by the on-chip peripheral i/o (serial in terface, timer/counter, and a/d converter), interrupts from external input pins, or software triggers (memory refers to internal ram or external memory). 18.1 features ? 4 independent dma channels ? transfer unit: 8/16 bits ? maximum transfer count: 65,536 (2 16 ) ? transfer type: two-cycle transfer ? transfer mode: single transfer mode ? transfer requests ? request by interrupts from on-chip peripheral i/o (seria l interface, timer/counter, a/d converter) or interrupts from external input pin ? requests by software trigger ? transfer targets ? internal ram ? peripheral i/o ? peripheral i/o ? peripheral i/o ? internal ram ? external memory ? external memory ? peripheral i/o ? external memory ? external memory
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 628 18.2 configuration cpu internal ram on-chip peripheral i/o on-chip peripheral i/o bus internal bus data control address control count control channel control dmac v850es/jj2 bus interface external bus external ram external rom external i/o dma source address register n (dsanh/dsanl) dma transfer count register n (dbcn) dma channel control register n (dchcn) dma destination address register n (ddanh/ddanl) dma addressing control register n (dadcn) dma trigger factor register n (dtfrn) remark n = 0 to 3
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 629 18.3 registers (1) dma source address registers 0 to 3 (dsa0 to dsa3) the dsa0 to dsa3 registers set the dma source addresse s (26 bits each) for dma channel n (n = 0 to 3). these registers are divided into two 16-bit registers, dsanh and dsanl. these registers can be read or written in 16-bit units. external memory or on-chip peripheral i/o internal ram ir 0 1 specification of dma transfer source set the address (a25 to a16) of the dma transfer source (default value is undefined). during dma transfer, the next dma transfer source address is held. when dma transfer is completed, the dma address set first is held. sa25 to sa16 set the address (a15 to a0) of the dma transfer source (default value is undefined). during dma transfer, the next dma transfer source address is held. when dma transfer is completed, the dma address set first is held. sa15 to sa0 after reset: undefined r/w address: dsa0h fffff082h, dsa1h fffff08ah, dsa2h fffff092h, dsa3h fffff09ah, dsa0l fffff080h, dsa1l fffff088h, dsa2l fffff090h, dsa3l fffff098h dsanl (n = 0 to 3) sa15 sa14 sa13 sa12 sa6 sa5 sa4 sa3 sa2 sa1 sa0 sa7 sa8 sa9 sa10 sa11 dsanh (n = 0 to 3) ir 000 sa22 sa21 sa20 sa19 sa18 sa17 sa16 sa23 sa24 sa25 0 0 cautions 1. be sure to clear bits 14 to 10 of the dsanh register to 0. 2. set the dsanh and dsanl registers at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. when the value of the dsan register is read, two 16-bit re gisters, dsanh and dsanl, are read. if reading and updating conflict, the value being updated may be read (see 18.13 cautions). 4. following reset, set the dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers are not set, the operation when dma transfer is started is not guaranteed.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 630 (2) dma destination address regi sters 0 to 3 (dda0 to dda3) the dda0 to dda3 registers set the dma destination addre ss (26 bits each) for dma channel n (n = 0 to 3). these registers are divided into two 16-bit registers, ddanh and ddanl. these registers can be read or written in 16-bit units. external memory or on-chip peripheral i/o internal ram ir 0 1 specification of dma transfer destination set an address (a25 to a16) of dma transfer destination (default value is undefined). during dma transfer, the next dma transfer destination address is held. when dma transfer is completed, the dma transfer source address set first is held. da25 to da16 set an address (a15 to a0) of dma transfer destination (default value is undefined). during dma transfer, the next dma transfer destination address is held. when dma transfer is completed, the dma transfer source address set first is held. da15 to da0 after reset: undefined r/w address: dda0h fffff086h, dda1h fffff08eh, dda2h fffff096h, dda3h fffff09eh, dda0l fffff084h, dda1l fffff08ch, dda2l fffff094h, dda3l fffff09ch ddanl (n = 0 to 3) da15 da14 da13 da12 da6 da5 da4 da3 da2 da1 da0 da7 da8 da9 da10 da11 ddanh (n = 0 to 3) ir 000 da22 da21 da20 da19 da18 da17 da16 da23 da24 da25 0 0 cautions 1. be sure to clear bits 14 to 10 of the ddanh register to 0. 2. set the ddanh and ddanl registers at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. when the value of the ddan register is read, two 16-bit registers, ddanh and ddanl, are read. if reading and updating conflict, a va lue being updated may be read (see 18.13 cautions). 4. following reset, set the dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers are not set, the operation when dma transfer is started is not guaranteed.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 631 (3) dma byte count registers 0 to 3 (dbc0 to dbc3) the dbc0 to dbc3 registers are 16-bit registers that set the byte transfer c ount for dma channel n (n = 0 to 3). these registers hold the remaining tr ansfer count during dma transfer. these registers are decremented by 1 per one transfer regardless of the trans fer data unit (8/16 bits), and the transfer is terminated if a borrow occurs. these registers can be read or written in 16-bit units. byte transfer count 1 or remaining byte transfer count byte transfer count 2 or remaining byte transfer count : byte transfer count 65,536 (2 16 ) or remaining byte transfer count bc15 to bc0 0000h 0001h : ffffh byte transfer count setting or remaining byte transfer count during dma transfer after reset: undefined r/w address: dbc0 fffff0c0h, dbc1 fffff0c2h, dbc2 fffff0c4h, dbc3 fffff0c6h dbcn (n = 0 to 3) 15 bc15 14 bc14 13 bc13 12 bc12 11 bc11 10 bc10 9 bc9 8 bc8 7 bc7 6 bc6 5 bc5 4 bc4 3 bc3 2 bc2 1 bc1 0 bc0 the number of transfer data set first is held when dma transfer is complete. cautions 1. set the dbcn register at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 2. following reset, set the dsanh, dsanl, ddanh, ddanl, and dbcn registers before starting dma transfer. if these registers are not set, the operation when dma transfer is started is not guaranteed.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 632 (4) dma addressing control registers 0 to 3 (dadc0 to dadc3) the dadc0 to dadc3 registers are 16-bit registers that control the dma transfer mode for dma channel n (n = 0 to 3). these registers can be read or written in 16-bit units. reset sets these registers to 0000h. dadcn (n = 0 to 3) 8 bits 16 bits ds0 0 1 setting of transfer data size increment decrement fixed setting prohibited sad1 0 0 1 1 sad0 0 1 0 1 setting of count direction of the transfer source address increment decrement fixed setting prohibited dad1 0 0 1 1 dad0 0 1 0 1 setting of count direction of the destination address after reset: 0000h r/w address: dadc0 fffff0d0h, dadc1 fffff0d2h, dadc2 fffff0d4h, dadc3 fffff0d6h sad1 sad0 dad1 dad0 0 0 0 0 0ds000 00 0 0 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 cautions 1. be sure to clear bits 15, 13 to 8, and 3 to 0 of the dadcn register to ?0?. 2. set the dadcn register at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 3. the ds0 bit specifies the size of the transfer data, and does not control bus sizing. if 8-bit data (ds0 bit = 0) is set, therefore, the lower data bus is not always used. 4. if the transfer data size is set to 16 bits (ds0 bit = 1), transfer cannot be started from an odd address. transfer is always started from an address with the first bit of the lower address aligned to 0. 5. if dma transfer is executed on an on-chip peripheral i/o register (as the transfer source or destination), be sure to specify the same transfer size as the re gister size. for example, to execute dma transfer on an 8-bit register , be sure to specify 8-bit transfer.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 633 (5) dma channel control registers 0 to 3 (dchc0 to dchc3) the dchc0 to dchc3 registers are 8-bit registers t hat control the dma transfer operating mode for dma channel n. these registers can be read or written in 8-bit or 1-bit units. (however, bit 7 is read-only and bits 1 and 2 are write-only. if bit 1 or 2 is read, the read value is always 0.) reset sets these registers to 00h. dchcn (n = 0 to 3) dma transfer had not completed. dma transfer had completed. it is set to 1 on the last dma transfer and cleared to 0 when it is read. tcn note 1 0 1 status flag indicates whether dma transfer through dma channel n has completed or not dma transfer disabled dma transfer enabled dma transfer is enabled when the enn bit is set to 1. when dma transfer is completed (when a terminal count is generated), this bit is automatically cleared to 0. to abort dma transfer, clear the enn bit to 0 by software. to resume, set the enn bit to 1 again. when aborting or resuming dma transfer, however, be sure to observe the procedure described in 18.13 cautions . enn 0 1 setting of whether dma transfer through dma channel n is to be enabled or disabled this is a software startup trigger of dma transfer. if this bit is set to 1 in the dma transfer enable state (tcn bit = 0, enn bit = 1), dma transfer is started. stgn note 2 after reset: 00h r/w address: dchc0 fffff0e0h, dchc1 fffff0e2h, dchc2 fffff0e4h, dchc3 fffff0e6h tcn note 1 0 0 0 0 initn note 2 stgn note 2 enn <0> <1> <2> 3 4 5 6 <7> initn note 2 if the initn bit is set to 1 with dma transfer disabled (enn bit = 0), the dma transfer status can be initialized. when re-setting the dma transfer status (re-setting the ddanh, ddanl, dsanh, dsanl, dbcn, and dadcn registers) before dma transfer is completed (before the tcn bit is set to 1), be sure to initialize the dma channel. when initializing the dma controller, however, be sure to observe the procedure described in 18.13 cautions . notes 1. the tcn bit is read-only. 2. the initn and stgn bits are write-only. cautions 1. be sure to clear bits 6 to 3 of the dchcn register to 0. 2. when dma transfer is completed (when a terminal count is generated), the enn bit is cleared to 0 and then the tcn bit is set to 1. if the dchcn regist er is read while its bits are being updated, a value indicating "transfer not completed and transfer is disabled" (tcn bit = 0 and enn bit = 0) may be read.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 634 (6) dma trigger factor registers 0 to 3 (dtfr0 to dtfr3) the dtfr0 to dtfr3 registers are 8-bit registers that control the dma transfer start trigger via interrupt request signals from on-chip peripheral i/o. the interrupt request signals set by these re gisters serve as dma transfer start factors. these registers can be read or written in 8-bit units. however, dfn bit can be read or written in 1-bit units. reset sets these registers to 00h. dtfrn (n = 0 to 3) no dma transfer request dma transfer request dfn note 0 1 dma transfer request flag after reset: 00h r/w address: dtfr0 fffff810h, dtfr1 fffff812h, dtfr2 fffff814h, dtfr3 fffff816h dfn 0 ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 0 1 2 3 4 5 6 <7> note the dfn bit is a write-only bit. write 0 to this bi t to clear a dma transfer request if an interrupt that is specified as the cause of starting dma trans fer occurs while dma transfer is disabled. cautions 1. set the ifcn5 to if cn0 bits at the following timing when dma transfer is disabled (dchcn.enn bit = 0). ? period from after reset to start of first dma transfer ? period from after channel initialization by dchcn.initn bit to start of dma transfer ? period from after completion of dma transfer (dchcn.tcn bit = 1) to start of the next dma transfer 2. an interrupt request that is generated in the standby mode (idel1, idle2, stop, or sub- idle mode) does not start the dma transfer cycle (nor is the dfn bit set to 1). 3. if a dma start factor is selected by the ifcn 5 to ifcn0 bits, the dfn bi t is set to 1 when an interrupt occurs from the selected on-chip pe ripheral i/o, regardless of whether the dma transfer is enabled or disable d. if dma is enabled in this status, dma transfer is immediately started. remark for the ifcn5 to ifcn0 bits, see table 18-1 dma start factors .
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 635 table 18-1. dma start factors (1/2) ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 0 0 0 0 0 0 dma request by interrupt disabled 0 0 0 0 0 1 intp0 0 0 0 0 1 0 intp1 0 0 0 0 1 1 intp2 0 0 0 1 0 0 intp3 0 0 0 1 0 1 intp4 0 0 0 1 1 0 intp5 0 0 0 1 1 1 intp6 0 0 1 0 0 0 intp7 0 0 1 0 0 1 inttq0ov 0 0 1 0 1 0 inttq0cc0 0 0 1 0 1 1 inttq0cc1 0 0 1 1 0 0 inttq0cc2 0 0 1 1 0 1 inttq0cc3 0 0 1 1 1 0 inttp0ov 0 0 1 1 1 1 inttp0cc0 0 1 0 0 0 0 inttp0cc1 0 1 0 0 0 1 inttp1ov 0 1 0 0 1 0 inttp1cc0 0 1 0 0 1 1 inttp1cc1 0 1 0 1 0 0 inttp2ov 0 1 0 1 0 1 inttp2cc0 0 1 0 1 1 0 inttp2cc1 0 1 0 1 1 1 inttp3cc0 0 1 1 0 0 0 inttp3cc1 0 1 1 0 0 1 inttp4cc0 0 1 1 0 1 0 inttp4cc1 0 1 1 0 1 1 inttp5cc0 0 1 1 1 0 0 inttp5cc1 0 1 1 1 0 1 inttm0eq0 0 1 1 1 1 0 intcb0r/intiic1 0 1 1 1 1 1 intcb0t 1 0 0 0 0 0 intcb1r 1 0 0 0 0 1 intcb1t 1 0 0 0 1 0 intcb2r 1 0 0 0 1 1 intcb2t 1 0 0 1 0 0 intcb3r 1 0 0 1 0 1 intcb3t 1 0 0 1 1 0 intua0r/intcb4r 1 0 0 1 1 1 intua0t/intcb4t 1 0 1 0 0 0 intua1r/intiic2 1 0 1 0 0 1 intua1t 1 0 1 0 1 0 intua2r/intiic0 remark n = 0 to 3
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 636 table 18-1. dma start factors (2/2) ifcn5 ifcn4 ifcn3 ifcn2 ifcn1 ifcn0 interrupt source 1 0 1 0 1 1 intua2t 1 0 1 1 0 0 intad 1 0 1 1 0 1 intkr 1 1 0 0 0 1 intp8 1 1 0 0 1 0 inttp6cc0 1 1 0 0 1 1 inttp6cc1 1 1 0 1 0 0 inttp7cc0 1 1 0 1 0 1 inttp7cc1 1 1 0 1 1 0 inttp8cc0 1 1 0 1 1 1 inttp8cc1 1 1 1 0 0 0 intcb5r 1 1 1 0 0 1 intcb5t 1 1 1 0 1 0 intua3r 1 1 1 0 1 1 intua3t other than above setting prohibited remark n = 0 to 3 18.4 transfer targets table 18-2 shows the relationship between the transfer targets ( : transfer enabled, : transfer disabled). table 18-2. relationship between transfer targets transfer destination internal rom on-chip peripheral i/o internal ram external memory on-chip peripheral i/o internal ram external memory source internal rom caution the operation is not guaranteed for combinat ions of transfer destination and source marked with " " in table 18-2.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 637 18.5 transfer modes single transfer is supported as the transfer mode. in single transfer mode, the bus is released at each byte/hal fword transfer. if there is a subsequent dma transfer request, transfer is performed again once. this operation continues until a terminal count occurs. when the dmac has released the bus, if another higher priority dma transfer request is issued, the higher priority dma request always takes precedence. if a new transfer request of the same channel and a transfer request of another channel with a lower priority are generated in a transfer cycle, dma transfer of the channel with the lower priority is executed after the bus is released to the cpu (the new transfer request of the same channel is ignored in the transfer cycle). 18.6 transfer types as a transfer type, the 2-cycle transfer is supported. in two-cycle transfer, data transfer is performed in two cycles, a read cycle and a write cycle. in the read cycle, the transfer source address is output and reading is performed from the source to the dmac. in the write cycle, the transfer destination addr ess is output and writing is performed from the dmac to the destination. an idle cycle of one clock is always inserted between a read cycle and a write cycle. if the data bus width differs between the transfer source and destination for dma transfe r of two cycles, the operation is performed as follows. <16-bit data transfer> <1> transfer from 32-bit bus 16-bit bus a read cycle (the higher 16 bits are in a high-impedan ce state) is generated, followed by generation of a write cycle (16 bits). <2> transfer from 16-/32-bit bus to 8-bit bus a 16-bit read cycle is generated once, and then an 8-bit write cycle is generated twice. <3> transfer from 8-bit bus to 16-/32-bit bus an 8-bit read cycle is generated twice, and then a 16-bit write cycle is generated once. <4> transfer between 16-bit bus and 32-bit bus a 16-bit read cycle is generated once, and then a 16-bit write cycle is generated once. for dma transfer executed to an on-chip peripheral i/o register (transfer source /destination), be sure to specify the same transfer size as the register size. for example, for dma transfer to an 8-bit register, be sure to specify byte (8- bit) transfer. remark the bus width of each transfer target (tr ansfer source/destination) is as follows. ? on-chip peripheral i/o: 16-bit bus width ? internal ram: 32-bit bus width ? external memory: 8-bit or 16-bit bus width
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 638 18.7 dma channel priorities the dma channel priorities are fixed as follows. dma channel 0 > dma channel 1 > dma channel 2 > dma channel 3 the priorities are checked for every transfer cycle. 18.8 time related to dma transfer the time required to respond to a dma request, and the minimum number of clocks required for dma transfer are shown below. single transfer: dma response time (<1>) + transfer source memory access (<2>) + 1 note 1 + transfer destination memory access (<2>) dma cycle minimum number of execution clocks <1> dma request response time 4 clocks (min.) + noise elimination time note 2 external memory access depends on connected memory. internal ram access 2 clocks note 3 <2> memory access peripheral i/o register access 3 clocks + number of wait cycles specified by vswc register note 4 notes 1. one clock is always inserted between a read cycle and a write cycle in dma transfer. 2. if an external interrupt (intpn) is specified as the tr igger to start dma transfer, noise elimination time is added (n = 0 to 7). 3. two clocks are required for a dma cycle. 4. more wait cycles are necessary for accessing a specific peripheral i/o register (for details, see 3.4.8 (2) ).
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 639 18.9 dma transfer start factors there are two types of dma transfe r start factors, as shown below. (1) request by software if the stgn bit is set to 1 while the dchcn.tcn bit = 1 and enn bit = 1 (dma transfer enabled), dma transfer is started. to request the next dma transfer cycle immediately after that, confirm, by using th e dbcn register, that the preceding dma transfer cycle has been completed, and set the stgn bit to 1 again (n = 0 to 3). tcn bit = 0, enn bit = 1 stgn bit = 1 ? starts the first dma transfer. confirm that the contents of the dbcn register have been updated. stgn bit = 1 ? starts the second dma transfer. : generation of terminal count ? enn bit = 0, tc n bit = 1, and intdman signal is generated. (2) request by on-chip peripheral i/o if an interrupt request is generated from the on-chip peripheral i/o set by the dtfrn register when the dchcn.tcn bit = 0 and enn bit = 1 (dma transf er enabled), dma transfer is started. cautions 1. two start factors (software trigger a nd hardware trigger) cannot be used for one dma channel. if two start factors are simultane ously generated for one dma channel, only one of them is valid. the start factor that is valid cannot be identified. 2. a new transfer request that is generate d after the preceding dma transfer request was generated or in the preceding dma tran sfer cycle is ignored (cleared). 3. the transfer request inte rval of the same dma channel varies depending on the setting of bus wait in the dma transfer cycle, the start status of the other channels, or the external bus hold request. in particular, as described in caution 2, a new transfer request that is generated for the same channel before the dma transfer cycle or during the dma transfer cycle is ignored. therefore, the transfer re quest intervals for the same dma channel must be sufficiently separated by th e system. when the software tr igger is used, completion of the dma transfer cycle that was generated before can be checked by updating the dbcn register.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 640 18.10 dma abort factors dma transfer is aborted if a bus hold occurs. the same applies if transfer is ex ecuted between the intern al memory/on-chip peripheral i/o and internal memory/on-chip peripheral i/o. when the bus hold is cleared, dma transfer is resumed. 18.11 end of dma transfer when dma transfer has been completed the number of ti mes set to the dbcn register and when the dchcn.enn bit is cleared to 0 and tcn bit is set to 1, a dma transfer end interrupt request signal (intdman) is generated for the interrupt controller (intc) (n = 0 to 3). the v850es/jj2 does not output a terminal count signal to an external device. therefore, confirm completion of dma transfer by using the dma transfer end interrupt or polling the tcn bit. 18.12 operation timing figures 18-1 to 18-4 show dma operation timing.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 641 figure 18-1. priority of dma (1) preparation for transfer read write idle end processing dma2 processing cpu processing dma1 processing cpu processing cpu processing dma0 processing dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit preparation for transfer read write idle end processing preparation for transfer read remarks 1. transfer in the order of dma0 dma1 dma2 2. in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 642 figure 18-2. priority of dma (2) preparation for transfer read write idle dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit cpu processing dma0 processing cpu processing dma1 processing cpu processing dma0 processing read write idle end processing read preparation for transfer preparation for transfer end processing remarks 1. transfer in the order of dma0 dma1 dma0 (dma2 is held pending.) 2. in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 643 figure 18-3. period in which dma transfer request is ignored (1) preparation for transfer read cycle write cycle idle end processing dma transfer mode of processing dfn bit system clock transfer request generated after this can be acknowledged dma0 processing cpu processing cpu processing note 2 note 2 dman transfer request note 1 note 2 notes 1. interrupt from on-chip peripheral i/o , or software trigger (stgn bit) 2. new dma request of the same channel is ignor ed between when the first request is generated and the end processing is complete. remark in the case of transfer between external memory spaces (multiplexed bus, no wait)
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 644 figure 18-4. period in which dma transfer request is ignored (2) preparation for transfer read write idle <1> <2> <3> <4> cpu processing dma0 processing cpu processing dma1 processing cpu processing dma0 processing dma0 transfer request system clock dma1 transfer request dma2 transfer request dma transfer mode of processing df0 bit df1 bit df2 bit preparation for transfer read write idle preparation for transfer read end processing end processing <1> dma0 transfer request <2> new dma0 transfer request is generated during dma0 transfer. a dma transfer request of the same channel is ignored during dma transfer. <3> requests for dma0 and dma1 are generated at the same time. dma0 request is ignored (a dma transfer request of the same channel during transfer is ignored). dma1 request is acknowledged. <4> requests for dma0, dma1, and dma2 are generated at the same time. dma1 request is ignored (a dma transfer request of the same channel during transfer is ignored). dma0 request is acknowledged according to priority. dma2 request is held pending (transfer of dma2 occurs next).
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 645 18.13 cautions (1) caution for vswc register when using the dmac, be sure to set an appropriate val ue, in accordance with the operating frequency, to the vswc register. when the default value (77h) of the vsw c register is used, or if an inappr opriate value is set to the vswc register, the operation is not correctly performed (for details of the vswc register, see 3.4.8 (1) (a) system wait control register (vswc) ). (2) caution for dma transfer executed on internal ram when executing the following instructions located in th e internal ram, do not ex ecute a dma transfer that transfers data to/from the internal ram (transfer source/destination), because the cpu may not operate correctly afterward. ? bit manipulation instruction located in internal ram (set1, clr1, or not1) ? data access instruction to misaligned address located in internal ram conversely, when executing a dma transfer to tran sfer data to/from the in ternal ram (transfer source/destination), do not execut e the above two instructions. (3) caution for reading dchcn .tcn bit (n = 0 to 3) the tcn bit is cleared to 0 when it is read, but it is not automat ically cleared even if it is read at a specific timing. to accurately clear the tcn bit, add the following processing. (a) when waiting for completion of dma transfer by polling tcn bit confirm that the tcn bit has been set to 1 (after tcn bit = 1 is read), and then read the tcn bit three more times. (b) when reading tcn bit in interrupt servicing routine execute reading the tcn bit three times.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 646 (4) dma transfer initialization pr ocedure (setting dchcn.initn bit to 1) even if the initn bit is set to 1 when the channel exec uting dma transfer is to be initialized, the channel may not be initialized. to accurately initialize the c hannel, execute either of the following two procedures. (a) temporarily stop transf er of all dma channels initialize the channel executing dma transfer using the procedure in <1> to <7> below. note, however, that tcn bit is cleared to 0 when st ep <5> is executed. make sure that the other processing programs do not expect that the tcn bit is 1. <1> disable interrupts (di). <2> read the dchcn.enn bit of dma channels other t han the one to be forcibly terminated, and transfer the value to a general-purpose register. <3> clear the enn bit of the dma channels used (including the channel to be forcibly terminated) to 0. to clear the enn bit of the last dma channel, execute t he clear instruction twice. if the target of dma transfer (transfer source/destination) is the inte rnal ram, execute the instruction three times. example: execute instructions in t he following order if channels 0, 1, and 2 are used (if the target of transfer is not the internal ram). ? clear dchc0.e00 bit to 0. ? clear dchc1.e11 bit to 0. ? clear dchc2.e22 bit to 0. ? clear dchc2.e22 bit to 0 again. <4> set the initn bit of the channel to be forcibly terminated to 1. <5> read the tcn bit of each channel not to be forcib ly terminated. if both the tcn bit and the enn bit read in <2> are 1 (logical product (and) is 1), clear the saved enn bit to 0. <6> after the operation in <5>, write the enn bit value to the dchcn register. <7> enable interrupts (ei). caution be sure to execute step <5> above to pr event illegal setting of the enn bit of the channels whose dma transfer has been normally completed between <2> and <3>.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 647 (b) repeatedly execute setting initn bit until transfer is forcibly terminated correctly <1> suppress a request from the dma request source of the channel to be forcibly terminated (stop operation of the on-ch ip peripheral i/o). <2> check that the dma transfer requ est of the channel to be forcibly terminated is not held pending, by using the dtfrn.dfn bit. if a dma transfer reques t is held pending, wait until execution of the pending request is completed. <3> when it has been confirmed that t he dma request of the channel to be forcibly terminated is not held pending, clear the enn bit to 0. <4> again, clear the enn bit of the channel to be forcibly terminated. if the target of transfer for the channel to be forc ibly terminated (transfer source/destination) is the internal ram, execute th is operation once more. <5> copy the initial number of trans fers of the channel to be forcibly terminated to a general-purpose register. <6> set the initn bit of the channel to be forcibly terminated to 1. <7> read the value of the dbcn regist er of the channel to be forcibly terminated, and compare it with the value copied in <5>. if the two values do not match, repeat operations <6> and <7>. remarks 1. when the value of the dbcn regist er is read in <7>, the initial number of transfers is read if forced termination has been correctly completed. if not, the remaining number of transfers is read. 2. note that method (b) may take a long time if the application frequently uses dma transfer for a channel other than the dma channel to be forcibly terminated. (5) procedure of temporarily stoppi ng dma transfer (clearing enn bit) stop and resume the dma transfer under ex ecution using the following procedure. <1> suppress a transfer request from the dma request s ource (stop the operation of the on-chip peripheral i/o). <2> check the dma transfer request is not held pending , by using the dfn bit (check if the dfn bit = 0). if a request is pending, wait until execution of the pending dma transfer request is completed. <3> if it has been confirmed that no dma transfer requ est is held pending, clear the enn bit to 0 (this operation stops dma transfer). <4> set the enn bit to 1 to resume dma transfer. <5> resume the operation of the dma request source that has been stopped (start the operation of the on- chip peripheral i/o). (6) memory boundary the operation is not guaranteed if th e address of the transfer source or destination exceeds the area of the dma target (external memory, internal ram, or on-chip peripheral i/o) during dma transfer. (7) transferring misaligned data dma transfer of misaligned data with a 16-bit bus width is not supported. if an odd address is specified as the trans fer source or destination, the leas t significant bit of the address is forcibly assumed to be 0.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 648 (8) bus arbitration for cpu because the dma controller has a higher priority bus ma stership than the cpu, a cpu access that takes place during dma transfer is held pending unt il the dma transfer cycle is complete d and the bus is released to the cpu. however, the cpu can access the external memory, on- chip peripheral i/o, and inte rnal ram to/from which dma transfer is not being executed. ? the cpu can access the internal ram when dma transfer is being executed between the external memory and on-chip peripheral i/o. ? the cpu can access the internal ram and on-chip peripheral i/o when dma transfer is being executed between the external memory and external memory. (9) registers/bits that must not be rewritten during dma operation set the following registers at the following ti ming when a dma operation is not under execution. [registers] ? dsanh, dsanl, ddanh, ddanl, dbcn, and dadcn registers ? dtfrn.ifcn5 to dtfrn.ifcn0 bits [timing of setting] ? period from after reset to start of the first dma transfer ? time after channel initializ ation to start of dma transfer ? period from after completion of dma transfer (tcn bit = 1) to start of the next dma transfer (10) be sure to set the foll owing register bits to 0. ? bits 14 to 10 of dsanh register ? bits 14 to 10 of ddanh register ? bits 15, 13 to 8, and 3 to 0 of dadcn register ? bits 6 to 3 of dchcn register (11) dma start factor do not start two or more dma channels with the same st art factor. if two or more channels are started with the same factor, a dma channel with a lower priority may be acknowledged earlier than a dma channel with a higher priority.
chapter 18 dma function (dma controller) preliminary user's manual u17714ej1v0ud 649 (12) read values of dsan and ddan registers values in the middle of updating may be read from t he dsan and ddan registers during dma transfer (n = 0 to 3). for example, if the dsanh regist er and then the dsanl register ar e read when the dma transfer source address (dsan register) is 0000ffffh and the count direction is incremental (dadcn.sad1 and dadcn.sad0 bits = 00), the value of the dsan regist er differs as follows, depending on whether dma transfer is executed immediately after the dsanh register is read. (a) if dma transfer does not occu r while dsan register is read <1> read value of dsanh register: dsanh = 0000h <2> read value of dsanl register: dsanl = ffffh (b) if dma transfer occurs while dsan register is read <1> read value of dsanh register: dsanh = 0000h <2> occurrence of dma transfer <3> incrementing dsan register: dsan = 00100000h <4> read value of dsanl register: dsanl = 0000h
preliminary user's manual u17714ej1v0ud 650 chapter 19 interrupt/except ion processing function the v850es/jj2 is provided with a dedicated interrupt cont roller (intc) for interrupt servicing and can process a total of 71 interrupt requests. an interrupt is an event that occurs independently of program execution, and an ex ception is an event whose occurrence is dependent on program execution. the v850es/jj2 can process interrupt re quest signals from the on-chip peripheral hardware and external sources. moreover, exception processing can be st arted by the trap instruction (softwar e exception) or by generation of an exception event (i.e. fetching of an illegal opcode) (exception trap). 19.1 features interrupts ? non-maskable interrupts: 2 sources  maskable interrupts: external: 9, internal: 60 sources  8 levels of programmable priorities (maskable interrupts)  multiple interrupt control according to priority  masks can be specified for eac h maskable interrupt request.  noise elimination, edge detection, and valid edge specification for external interrupt request signals. exceptions  software exceptions: 32 sources  exception trap: 2 sources (illegal opcode exception, debug trap) interrupt/exception sources are listed in table 19-1.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 651 table 19-1. interrupt source list (1/3) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register reset interrupt ? reset reset pin input reset by internal source reset 0000h 00000000h undefined ? ? nmi nmi pin valid edge input pin 0010h 00000010h nextpc ? non- maskable interrupt ? intwdt2 wdt2 overflow wdt2 0020h 00000020h note 1 ? ? trap0n note 2 trap instruction ? 004nh note 2 00000040h nextpc ? software exception exception ? trap1n note 2 trap instruction ? 005nh note 2 00000050h nextpc ? exception trap exception ? ilgop/ dbg0 illegal opcode/dbtrap instruction ? 0060h 00000060h nextpc ? 0 intlvi low-voltage detection poclvi 0080h 00000080h nextpc lviic 1 intp0 external interrupt pin input edge detection (intp0) pin 0090h 00000090h nextpc pic0 2 intp1 external interrupt pin input edge detection (intp1) pin 00a0h 000000a0h nextpc pic1 3 intp2 external interrupt pin input edge detection (intp2) pin 00b0h 000000b0h nextpc pic2 4 intp3 external interrupt pin input edge detection (intp3) pin 00c0h 000000c0h nextpc pic3 5 intp4 external interrupt pin input edge detection (intp4) pin 00d0h 000000d0h nextpc pic4 6 intp5 external interrupt pin input edge detection (intp5) pin 00e0h 000000e0h nextpc pic5 7 intp6 external interrupt pin input edge detection (intp6) pin 00f0h 000000f0h nextpc pic6 8 intp7 external interrupt pin input edge detection (intp7) pin 0100h 00000100h nextpc pic7 9 inttq0ov tmq0 overflow tmq0 0110h 00000110h nextpc tq0ovic 10 inttq0cc0 tmq0 capture 0/compare 0 ma tch tmq0 0120h 00000120h nextpc tq0ccic0 11 inttq0cc1 tmq0 capture 1/compare 1 ma tch tmq0 0130h 00000130h nextpc tq0ccic1 12 inttq0cc2 tmq0 capture 2/compare 2 ma tch tmq0 0140h 00000140h nextpc tq0ccic2 13 inttq0cc3 tmq0 capture 3/compare 3 ma tch tmq0 0150h 00000150h nextpc tq0ccic3 14 inttp0ov tmp0 overflow tmp0 0160h 00000160h nextpc tp0ovic 15 inttp0cc0 tmp0 capture 0/compare 0 ma tch tmp0 0170h 00000170h nextpc tp0ccic0 16 inttp0cc1 tmp0 capture 1/compare 1 ma tch tmp0 0180h 00000180h nextpc tp0ccic1 17 inttp1ov tmp1 overflow tmp1 0190h 00000190h nextpc tp1ovic 18 inttp1cc0 tmp1 capture 0/compare 0 matc h tmp1 01a0h 000001a0h nextpc tp1ccic0 19 inttp1cc1 tmp1 capture 1/compare 1 matc h tmp1 01b0h 000001b0h nextpc tp1ccic1 20 inttp2ov tmp2 overflow tmp2 01c0h 000001c0h nextpc tp2ovic 21 inttp2cc0 tmp2 capture 0/compare 0 matc h tmp2 01d0h 000001d0h nextpc tp2ccic0 22 inttp2cc1 tmp2 capture 1/compare 1 matc h tmp2 01e0h 000001e0h nextpc tp2ccic1 23 inttp3ov tmp3 overflow tmp3 01f0h 000001f0h nextpc tp3ovic 24 inttp3cc0 tmp3 capture 0/compare 0 ma tch tmp3 0200h 00000200h nextpc tp3ccic0 maskable interrupt 25 inttp3cc1 tmp3 capture 1/compare 1 ma tch tmp3 0210h 00000210h nextpc tp3ccic1 notes 1. for the restoring in the case of intwdt2, see 19.2.2 (2) from intwdt2 signal . 2. n = 0 to fh
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 652 table 19-1. interrupt source list (2/3) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register 26 inttp4ov tmp4 overflow tmp4 0220h 00000220h nextpc tp4ovic 27 inttp4cc0 tmp4 capture 0/compare 0 match tmp4 0230h 00000230h nextpc tp4ccic0 28 inttp4cc1 tmp4 capture 1/compare 1 match tmp4 0240h 00000240h nextpc tp4ccic1 29 inttp5ov tmp5 overflow tmp5 0250h 00000250h nextpc tp5ovic 30 inttp5cc0 tmp5 capture 0/compare 0 match tmp5 0260h 00000260h nextpc tp5ccic0 31 inttp5cc1 tmp5 capture 1/compare 1 match tmp5 0270h 00000270h nextpc tp5ccic1 32 inttm0eq0 tmm0 compare match tmm0 0280h 00000280h nextpc tm0eqic0 33 intcb0r/ intiic1 csib0 reception completion/ csib0 reception error/ iic1 transfer completion csib0/ iic1 0290h 00000290h nextpc cb0ric/ iicic1 34 intcb0t csib0 consecutive transmission write enable csib0 02a0h 000002a0h nextpc cb0tic 35 intcb1r csib1 reception completion/ csib1 reception error csib1 02b0h 000002b0h nextpc cb1ric 36 intcb1t csib1 consecutive transmission write enable csib1 02c0h 000002c0h nextpc cb1tic 37 intcb2r csib2 reception completion/ csib2 reception error csib2 02d0h 000002d0h nextpc cb2ric 38 intcb2t csib2 consecutive transmission write enable csib2 02e0h 000002e0h nextpc cb2tic 39 intcb3r csib3 reception completion/ csib3 reception error csib3 02f0h 000002f0h nextpc cb3ric 40 intcb3t csib3 consecutive transmission write enable csib3 0300h 00000300h nextpc cb3tic 41 intua0r/ intcb4r uarta0 reception completion/ csib4 reception completion/ csib4 reception error uarta0/ csib4 0310h 00000310h nextpc ua0ric/ cb4ric 42 intua0t/ intcb4t uarta0 consecutive transmission enable/ csib4 consecutive transmission write enable uarta0/ csib4 0320h 00000320h nextpc ua0tic/ cb4tic 43 intua1r/ intiic2 uarta1 reception completion/ uarta1 reception error/ iic2 transfer completion uarta1/ iic2 0330h 00000330h nextpc ua1ric/ iicic2 44 intua1t uarta1 consecutive transmission enable uarta1 0340h 00000340h nextpc ua1tic 45 intua2r/ intiic0 uarta2 reception completion/ iic0 transfer completion uarta/ iic0 0350h 00000350h nextpc ua2ric/ iicic0 46 intua2t uarta2 consecutive transmission enable uarta2 0360h 00000360h nextpc ua2tic 47 intad a/d conversion completi on a/d 0370h 00000370h nextpc adic 48 intdma0 dma0 transfer completi on dma 0380h 00000380h nextpc dmaic0 49 intdma1 dma1 transfer completi on dma 0390h 00000390h nextpc dmaic1 50 intdma2 dma2 transfer completion dma 03a0h 000003a0h nextpc dmaic2 51 intdma3 dma3 transfer completion dma 03b0h 000003b0h nextpc dmaic3 52 intkr key return interrupt kr 03c0h 000003c0h nextpc kric 53 intwti watch timer interval wt 03d0h 000003d0h nextpc wtiic maskable interrupt 54 intwt watch timer reference time wt 03e0h 000003e0h nextpc wtic
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 653 table 19-1. interrupt source list (3/3) type classification default priority name trigger generating unit exception code handler address restored pc interrupt control register 55 intp8 external interrupt pin input edge detection (intp8) pin 0470h 00000470h nextpc pic8 56 inttp6ov tmp6 overflow tmp6 0480h 00000480h nextpc tp6ovic 57 inttp6cc0 tmp6 capture 0/compare 0 ma tch tmp6 0490h 00000490h nextpc tp6ccic0 58 inttp6cc1 tmp6 capture 1/compare 1 ma tch tmp6 04a0h 000004a0h nextpc tp6ccic1 59 inttp7ov tmp7 overflow tmp7 04b0h 000004b0h nextpc tp7ovic 60 inttp7cc0 tmp7 capture 1/compare 0 ma tch tmp7 04c0h 000004c0h nextpc tp7ccic0 61 inttp7cc1 tmp7 capture 1/compare 1 ma tch tmp7 04d0h 000004d0h nextpc tp7ccic1 62 inttp8ov tmp8 overflow tmp8 04e0h 000004e0h nextpc tp8ovic 63 inttp8cc0 tmp8 capture 0/compare 0 ma tch tmp8 04f0h 000004f0h nextpc tp8ccic0 64 inttp8cc1 tmp8 capture 1/compare 1 ma tch tmp8 0500h 00000500h nextpc tp8ccic1 65 intcb5r csib5 reception completion csib5 0510h 00000510h nextpc cb5ric 66 intcb5t csib5 consecutive transmission write enable csib5 0520h 00000520h nextpc cb5tic 67 intua3r uart3 consecutive reception completion uarta3 0530h 00000530h nextpc ua3ric maskable interrupt 68 intua3t uarta3 consecutive transmission enable uarta3 0540h 00000540h nextpc ua3tic remarks 1. default priority: the priority order when two or more maskable interrupt requests occur at the same time. the highest priority is 0. the priority order of non-maskable interrupt is intwdt2 > nmi. restored pc: the value of the program count er (pc) saved to eipc, fepc, or dbpc when interrupt servicing is started. note, however, that the restored pc when a non- maskable or maskable interrupt is acknowledged while one of the following instructions is being executed does not become the nextpc (if an interrupt is acknowledged during interrupt execution, execution stops, and then resumes after the interrupt servicing has finished). ? load instructions (sld.b, sld.bu, sld.h, sld.hu, sld.w) ? division instructions (div, divh, divu, divhu) ? prepare, dispose instructions (only if an interrupt is generated before the stack pointer is updated) nextpc: the pc value that starts the proc essing following interrupt/exception processing. 2. the execution address of the illegal instruction when an illegal opcode exception occurs is calculated by (restored pc ? 4).
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 654 19.2 non-maskable interrupts a non-maskable interrupt request signal is acknowledged unconditionally, even when interrupts are in the interrupt disabled (di) status. an nmi is not subject to priority control and takes precedence over all the other interrupt request signals. this product has the following two non-maskable interrupt request signals. ? nmi pin input (nmi) ? non-maskable interrupt request signal generated by overflow of watchdog timer (intwdt2) the valid edge of the nmi pin can be se lected from four types: "rising edge", "falling edge", "both edges", and "no edge detection". the non-maskable interrupt request signal generated by over flow of watchdog timer 2 (intwdt2) functions when the wdtm2.wdm21 and wdtm2.wdm20 bits are set to "01". if two or more non-maskable interrupt request signals occur at the same time, the interrupt with the higher priority is serviced, as follows (the interrupt reques t signal with the lower priority is ignored). intwdt2 > nmi if a new nmi or intwdt2 request signal is issued while an nmi is being serviced, it is serviced as follows. (1) if new nmi request signal is i ssued while nmi is being serviced the new nmi request signal is held pending, regardle ss of the value of the psw.np bit. the pending nmi request signal is acknowledged after the nmi currently under execution has been serviced (after the reti instruction has been executed). (2) if intwdt2 request signal is issued while nmi is being serviced the intwdt2 request signal is held pending if the np bit remains set (1) while the nmi is being serviced. the pending intwdt2 request signal is acknowledged after the nmi currently under execution has been serviced (after the reti instruction has been executed). if the np bit is cleared (0) while the nmi is being serviced, the newly generated intwdt2 request signal is executed (the nmi servicing is stopped). caution for the non-maskable in terrupt servicing executed by th e non-maskable interrupt request signal (intwdt2), see 19.2.2 (2 ) from intwdt2 signal. figure 19-1. non-maskable interrupt requ est signal acknowledgment operation (1/2) (a) nmi and intwdt2 request signa ls generated at the same time main routine system reset nmi and intwd t2 requests (generated simultaneously) intwd t2 servicing
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 655 figure 19-1. non-maskable interrupt requ est signal acknowledgment operation (2/2) (b) non-maskable interrupt request signal ge nerated during non-maskab le interrupt servicing non-maskable interrupt being serviced non-maskable interrupt request signal generated during non-maskable interrupt servicing nmi intwdt2 nmi ? nmi request generated during nmi servicing ? intwdt2 request generated during nmi servicing (np bit = 1 retained before intwdt2 request) main routine nmi request nmi servicing (held pending) servicing of pending nmi nmi request main routine system reset nmi request nmi servicing (held pending) intwdt2 servicing intwdt2 request ? intwdt2 request generated during nmi servicing (np bit = 0 set before intwdt2 request) main routine system reset nmi request nmi servicing intwdt2 servicing intwdt2 request np = 0 ? intwdt2 request generated during nmi servicing (np = 0 set after intwdt2 request) main routine system reset nmi request nmi servicing intwdt2 servicing np = 0 ? intwdt2 request generated during intwdt2 servicing main routine system reset intwdt2 request intwdt2 servicing (invalid) ? nmi request generated during intwdt2 servicing intwdt2 main routine system reset intwdt2 request intwdt2 servicing (invalid) nmi request (held pending) intwdt2 request intwdt2 request
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 656 19.2.1 operation if a non-maskable interrupt request signal is generated, the cpu performs the following processing, and transfers control to the handler routine. <1> saves the restored pc to fepc. <2> saves the current psw to fepsw. <3> writes exception code (0010h, 0020h) to the higher halfword (fecc) of ecr. <4> sets the psw.np and psw.id bits to 1 and clears the psw.ep bit to 0. <5> sets the handler address (00000010h, 00000020h) corresponding to the non-maskable interrupt to the pc, and transfers control. the servicing configuration of a non- maskable interrupt is shown below. figure 19-2. servicing configurat ion of non-maskable interrupt psw.np fepc fepsw ecr.fecc psw.np psw.ep psw.id pc restored pc psw 0010h, 0020h 1 0 1 00000010h, 00000020h 1 0 nmi input non-maskable interrupt request interrupt servicing interrupt request held pending intc acknowledged cpu processing
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 657 19.2.2 restore (1) from nmi pin input execution is restored from the nmi se rvicing by the reti instruction. when the reti instruction is execut ed, the cpu performs the following proc essing, and transfers control to the address of the restored pc. <1> loads the restored pc and psw from fepc and f epsw, respectively, because the psw.ep bit is 0 and the psw.np bit is 1. <2> transfers control back to the address of the restored pc and psw. the processing of the reti in struction is shown below. figure 19-3. reti instruction processing psw.ep reti instruction psw.np original processing restored 1 1 0 0 pc psw eipc eipsw pc psw fepc fepsw caution when the ep and np bits are changed by the ldsr instruction during non-maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 0 and the np bit back to 1 using the ldsr instruction immediately befo re the reti instruction. remark the solid line shows the cpu processing flow.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 658 (2) from intwdt2 signal restoring from non-maskable interrupt servicing exec uted by the non-maskable interrupt request (intwdt2) by using the reti instruction is disabled. execute the following software reset processing. figure 19-4. software reset processing intwdt2 occurs. fepc software reset processing address fepsw value that sets np bit = 1, ep bit = 0 reti reti 10 times (fepc and fepsw note must be set.) psw psw default value setting initialization processing intwdt2 servicing routine software reset processing routine note fepsw value that sets np bit = 1, ep bit = 0 19.2.3 np flag the np flag is a status flag that indicates that non -maskable interrupt servicing is under execution. this flag is set when a non-maskable interrupt request signal has been acknowledged, and masks non-maskable interrupt requests to prohibit multiple interrupts from being acknowledged. 0 np ep id sat cy ov s z psw no nmi interrupt servicing nmi interrupt currently being serviced np 0 1 nmi interrupt servicing status after reset: 00000020h
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 659 19.3 maskable interrupts maskable interrupt request signals can be masked by in terrupt control registers. the v850es/jj2 has 69 maskable interrupt sources. if two or more maskable interrupt request signals ar e generated at the same ti me, they are acknowledged according to the default pr iority. in addition to the default priority, eight levels of priorities can be specified by using the interrupt control registers (p rogrammable priority control). when an interrupt request signal has been acknowledged, the acknowledgment of other maskable interrupt request signals is disabled and the interrupt disabled (di) status is set. when the ei instruction is executed in an interrupt service routine, the interr upt enabled (ei) status is set, which enables servicing of interrupts having a higher priority t han the interrupt request signal in progress (specified by the interrupt control register). note that only interrupts with a higher priority will have this capability; interrupts with the same priority level cannot be nested. to enable multiple interrupts, however, save eipc and eipsw to memory or general-purpose registers before executing the ei instruction, and execute the di instruction bef ore the reti instruction to re store the original values of eipc and eipsw. 19.3.1 operation if a maskable interrupt occurs, the cpu performs the fo llowing processing, and transfers control to a handler routine. <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower halfword of ecr (eicc). <4> sets the psw. id bit to 1 and clears the psw. ep bit to 0. <5> sets the handler address corresponding to each interrupt to the pc, and transfers control. the maskable interrupt request signal masked by intc and the maskable interrupt request signal generated while another interrupt is being serviced (while the psw.np bit = 1 or the psw.id bit = 1) are held pending inside intc. in this case, servicing a new maskable interrupt is start ed in accordance with the priority of the pending maskable interrupt request signal if either the maskable interrupt is unmasked or the np and id bits are cleared to 0 by using the reti or ldsr instruction. how maskable interrupts are serviced is illustrated below.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 660 figure 19-5. maskable interrupt servicing int input xxif = 1 no xxmk = 0 no is the interrupt mask released? yes yes no no no maskable interrupt request interrupt request held pending psw.np psw.id 1 1 interrupt request held pending 0 0 interrupt servicing cpu processing intc acknowledged yes yes yes priority higher than that of interrupt currently being serviced? priority higher than that of other interrupt request? highest default priority of interrupt requests with the same priority? eipc eipsw ecr.eicc psw.ep psw.id corresponding bit of ispr note pc restored pc psw exception code 0 1 1 handler address interrupt requested? note for the ispr register, see 19.3.6 in-service priority register (ispr) .
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 661 19.3.2 restore recovery from maskable interrupt servicing is carried out by the reti instruction. when the reti instruction is executed , the cpu performs the following proc essing, and transfers control to the address of the restored pc. <1> loads the restored pc and psw from eipc and eipsw , respectively, because the psw.ep bit is 0 and the psw.np bit is 0. <2> transfers control back to the address of the restored pc and psw. the processing of the reti instruction is shown below. figure 19-6. reti instruction processing psw.ep reti instruction psw.np restores original processing 1 1 0 0 pc psw corresponding bit of ispr note eipc eipsw 0 pc psw fepc fepsw note for the ispr register, see 19.3.6 in-service priority register (ispr) . caution when the ep and np bits are changed by the ldsr instruction during maskable interrupt servicing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 0 and the np bit back to 0 using the ldsr instruction immediately befo re the reti instruction. remark the solid line shows the cpu processing flow.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 662 19.3.3 priorities of maskable interrupts the intc performs multiple interrupt servicing in which an interrupt is acknowledged while another interrupt is being serviced. multiple interrupts can be controlled by priority levels. there are two types of priority level c ontrol: control based on the default pr iority levels, and control based on the programmable priority levels that are spec ified by the interrupt priority level s pecification bit (xxprn) of the interrupt control register (xxicn). when two or more interrupts hav ing the same priority level specified by the xxprn bit are generated at the same time, interrupt request signals are se rviced in order depending on the priority level allocated to each interrupt request type (default priority le vel) beforehand. for more information, see table 19-1 interrupt source list . the programmable priority control customizes interru pt request signals into eight levels by setting the priority level specification flag. note that when an interrupt request signal is acknowled ged, the psw.id flag is automatica lly set to 1. therefore, when multiple interrupts are to be used, clear the id flag to 0 beforehand (for example, by placing the ei instruction in the interrupt service program) to set the interrupt enable mode. remark xx: identification name of each peripheral unit (see table 19-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 19-2 interrupt control register (xxicn) ).
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 663 figure 19-7. example of processing in which another interrupt request signal is issued while an interrupt is being serviced (1/2) main routine ei ei interrupt request a (level 3) servicing of a servicing of b servicing of c interrupt request c (level 3) servicing of d servicing of e ei interrupt request e (level 2) servicing of f ei servicing of g interrupt request g (level 1) interrupt request h (level 1) servicing of h interrupt request b is acknowledged because the priority of b is higher than that of a and interrupts are enabled. although the priority of interrupt request d is higher than that of c, d is held pending because interrupts are disabled. interrupt request f is held pending even if interrupts are enabled because its priority is lower than that of e. interrupt request h is held pending even if interrupts are enabled because its priority is the same as that of g. interrupt request b (level 2) interrupt request d (level 2) interrupt request f (level 3) caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remarks 1. a to u in the figure are the temporary names of interrupt request signals shown for the sake of explanation. 2. the default priority in the figure indicates the relative priority between two interrupt request signals.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 664 figure 19-7. example of processing in which another interrupt request signal is issued while an interrupt is being serviced (2/2) main routine ei interrupt request i (level 2) servicing of i servicing of k interrupt request j (level 3) servicing of j interrupt request l (level 2) ei ei ei interrupt request o (level 3) interrupt request s (level 1) interrupt request k (level 1) servicing of l servicing of n servicing of m servicing of s servicing of u servicing of t interrupt request m (level 3) interrupt request n (level 1) servicing of o interrupt request p (level 2) interrupt request q (level 1) interrupt request r (level 0) interrupt request u (level 2) note 2 interrupt request t (level 2) note 1 servicing of p servicing of q servicing of r ei if levels 3 to 0 are acknowledged interrupt request j is held pending because its priority is lower than that of i. k that occurs after j is acknowledged because it has the higher priority. interrupt requests m and n are held pending because servicing of l is performed in the interrupt disabled status. pending interrupt requests are acknowledged after servicing of interrupt request l. at this time, interrupt request n is acknowledged first even though m has occurred first because the priority of n is higher than that of m. pending interrupt requests t and u are acknowledged after servicing of s. because the priorities of t and u are the same, u is acknowledged first because it has the higher default priority, regardless of the order in which the interrupt requests have been generated. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. notes 1. lower default priority 2. higher default priority
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 665 figure 19-8. example of servicing interrupt request signals simu ltaneously generated default priority a > b > c main routine ei interrupt request a (level 2) interrupt request b (level 1) interrupt request c (level 1) servicing of interrupt request b . . servicing of interrupt request c servicing of interrupt request a interrupt request b and c are acknowledged first according to their priorities. because the priorities of b and c are the same, b is acknowledged first according to the default priority. caution to perform multiple interrupt servicing, the values of the eipc and eipsw registers must be saved before executing the ei instruction. when returning from multiple interrupt servicing, restore the values of eipc and eipsw after executing the di instruction. remarks 1. a to c in the figure are the temporary names of interrupt request signals shown for the sake of explanation. 2. the default priority in the figure indicates the relative priority between two interrupt request signals.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 666 19.3.4 interrupt control register (xxicn) the xxicn register is assigned to each interrupt request signal (maskable interrupt) and sets the control conditions for each maskable interrupt request. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 47h. caution disable interrupts (di) or mask the interrupt to read the xxicn.xxifn bit. if the xxifn bit is read while interrupts are enabled (ei) or while the in terrupt is unmasked, the correct value may not be read when acknowledging an interr upt and reading the bit conflict. xxifn interrupt request not issued interrupt request issued xxifn 0 1 interrupt request flag note xxicn xxmkn 0 0 0 xxprn2 xxprn1 xxprn0 interrupt servicing enabled interrupt servicing disabled (pending) xxmkn 0 1 interrupt mask flag specifies level 0 (highest). specifies level 1. specifies level 2. specifies level 3. specifies level 4. specifies level 5. specifies level 6. specifies level 7 (lowest). xxprn2 0 0 0 0 1 1 1 1 interrupt priority specification bit xxprn1 0 0 1 1 0 0 1 1 xxprn0 0 1 0 1 0 1 0 1 after reset: 47h r/w address: fffff112h to fffff1a8h <6> <7> note the flag xxlfn is reset automatically by the hardwa re if an interrupt request signal is acknowledged. remark xx: identification name of each peripheral unit (see table 19-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 19-2 interrupt control register (xxicn) ). the addresses and bits of the interrupt control registers are as follows.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 667 table 19-2. interrupt control register (xxicn) (1/2) bit address register <7> <6> 5 4 3 2 1 0 fffff110h lviic lviif lvimk 0 0 0 lvipr2 lvipr1 lvipr0 fffff112h pic0 pif0 pmk0 0 0 0 ppr02 ppr01 ppr00 fffff114h pic1 pif1 pmk1 0 0 0 ppr12 ppr11 ppr10 fffff116h pic2 pif2 pmk2 0 0 0 ppr22 ppr21 ppr20 fffff118h pic3 pif3 pmk3 0 0 0 ppr32 ppr31 ppr30 fffff11ah pic4 pif4 pmk4 0 0 0 ppr42 ppr41 ppr40 fffff11ch pic5 pif5 pmk5 0 0 0 ppr52 ppr51 ppr50 fffff11eh pic6 pif6 pmk6 0 0 0 ppr62 ppr61 ppr60 fffff120h pic7 pif7 pmk7 0 0 0 ppr72 ppr71 ppr70 fffff122h tq0ovic tq0ovif tq0ovmk 0 0 0 tq0ovpr2 tq0ovpr1 tq0ovpr0 fffff124h tq0ccic0 tq0ccif0 tq0ccmk0 0 0 0 tq0ccpr02 tq0ccpr01 tq0ccpr00 fffff126h tq0ccic1 tq0ccif1 tq0ccmk1 0 0 0 tq0ccpr12 tq0ccpr11 tq0ccpr10 fffff128h tq0ccic2 tq0ccif2 tq0ccmk2 0 0 0 tq0ccpr22 tq0ccpr21 tq0ccpr20 fffff12ah tq0ccic3 tq0ccif3 tq0ccmk3 0 0 0 tq0ccpr32 tq0ccpr31 tq0ccpr30 fffff12ch tp0ovic tp0ovif tp0ovmk 0 0 0 tp0ovpr2 tp0ovpr1 tp0ovpr0 fffff12eh tp0ccic0 tp0ccif0 tp0ccmk0 0 0 0 tp0ccpr02 tp0ccpr01 tp0ccpr00 fffff130h tp0ccic1 tp0ccif1 tp0ccmk1 0 0 0 tp0ccpr12 tp0ccpr11 tp0ccpr10 fffff132h tp1ovic tp1ovif tp1ovmk 0 0 0 tp1ovpr2 tp1ovpr1 tp1ovpr0 fffff134h tp1ccic0 tp1ccif0 tp1ccmk0 0 0 0 tp1ccpr02 tp1ccpr01 tp1ccpr00 fffff136h tp1ccic1 tp1ccif1 tp1ccmk1 0 0 0 tp1ccpr12 tp1ccpr11 tp1ccpr10 fffff138h tp2ovic tp2ovif tp2ovmk 0 0 0 tp2ovpr2 tp2ovpr1 tp2ovpr0 fffff13ah tp2ccic0 tp2ccif0 tp2ccmk0 0 0 0 tp2ccpr02 tp2ccpr01 tp2ccpr00 fffff13ch tp2ccic1 tp2ccif1 tp2ccmk1 0 0 0 tp2ccpr12 tp2ccpr11 tp2ccpr10 fffff13eh tp3ovic tp3ovif tp3ovmk 0 0 0 tp3ovpr2 tp3ovpr1 tp3ovpr0 fffff140h tp3ccic0 tp3ccif0 tp3ccmk0 0 0 0 tp3ccpr02 tp3ccpr01 tp3ccpr00 fffff142h tp3ccic1 tp3ccif1 tp3ccmk1 0 0 0 tp3ccpr12 tp3ccpr11 tp3ccpr10 fffff144h tp4ovic tp4ovif tp4ovmk 0 0 0 tp4ovpr2 tp4ovpr1 tp4ovpr0 fffff146h tp4ccic0 tp4ccif0 tp4ccmk0 0 0 0 tp4ccpr02 tp4ccpr01 tp4ccpr00 fffff148h tp4ccic1 tp4ccif1 tp4ccmk1 0 0 0 tp4ccpr12 tp4ccpr11 tp4ccpr10 fffff14ah tp5ovic tp5ovif tp5ovmk 0 0 0 tp5ovpr2 tp5ovpr1 tp5ovpr0 fffff14ch tp5ccic0 tp5ccif0 tp5ccmk0 0 0 0 tp5ccpr02 tp5ccpr01 tp5ccpr00 fffff14eh tp5ccic1 tp5ccif1 tp5ccmk1 0 0 0 tp5ccpr12 tp5ccpr11 tp5ccpr10 fffff150h tm0eqic0 tm0eqif0 tm0eqmk0 0 0 0 tm0eqpr02 tm0eqpr01 tm0eqpr00 fffff152h cb0ric/ iicic1 cb0rif/ iicif1 cb0rmk/ iicmk1 0 0 0 cb0rpr2/ iicpr12 cb0rpr1/ iicpr11 cb0rpr0/ iicpr10 fffff154h cb0tic cb0tif cb0tmk 0 0 0 cb0tpr2 cb0tpr1 cb0tpr0 fffff156h cb1ric cb1rif cb1rmk 0 0 0 cb1rpr2 cb1rpr1 cb1rpr0 fffff158h cb1tic cb1tif cb1tmk 0 0 0 cb1tpr2 cb1tpr1 cb1tpr0 fffff15ah cb2ric cb2rif cb2rmk 0 0 0 cb2rpr2 cb2rpr1 cb2rpr0 fffff15ch cb2tic cb2tif cb2tmk 0 0 0 cb2tpr2 cb2tpr1 cb2tpr0 fffff15eh cb3ric cb3rif cb3rmk 0 0 0 cb3rpr2 cb3rpr1 cb3rpr0 fffff160h cb3tic cb3tif cb3tmk 0 0 0 cb3tpr2 cb3tpr1 cb3tpr0
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 668 table 19-2. interrupt control register (xxicn) (2/2) bit address register <7> <6> 5 4 3 2 1 0 fffff162h ua0ric/ cb4ric ua0rif/ cb4rif ua0rmk/ cb4rmk 0 0 0 ua0rpr2/ cb4rpr2 ua0rpr1/ cb4rpr1 ua0rpr0/ cb4rpr0 fffff164h ua0tic/ cb4tic ua0tif/ cb4tif ua0tmk/ cb4tmk 0 0 0 ua0tpr2/ cb4tpr2 ua0tpr1/ cb4tpr1 ua0tpr0/ cb4tpr0 fffff166h ua1ric/ iicic2 ua1rif/ iicif2 ua1rmk/ iicmk2 0 0 0 ua1rpr2/ iicpr22 ua1rpr1/ iicpr21 ua1rpr0/ iicpr20 fffff168h ua1tic ua1tif ua1tmk 0 0 0 ua1tpr2 ua1tpr1 ua1tpr0 fffff16ah ua2ric/ iicic0 ua2rif/ iicif0 ua2rmk/ iicmk0 0 0 0 ua2rpr2/ iicpr02 ua2rpr1/ iicpr01 ua2rpr0/ iicpr00 fffff16ch ua2tic ua2tif ua2tmk 0 0 0 ua2tpr2 ua2tpr1 ua2tpr0 fffff16eh adic adif admk 0 0 0 adpr2 adpr1 adpr0 fffff170h dmaic0 dmaif0 dmamk0 0 0 0 dmapr02 dmapr01 dmapr00 fffff172h dmaic1 dmaif1 dmamk1 0 0 0 dmapr12 dmapr11 dmapr10 fffff174h dmaic2 dmaif2 dmamk2 0 0 0 dmapr22 dmapr21 dmapr20 fffff176h dmaic3 dmaif3 dmamk3 0 0 0 dmapr32 dmapr31 dmapr30 fffff178h kric krif krmk 0 0 0 krpr2 krpr1 krpr0 fffff17ah wtiic wtiif wtimk 0 0 0 wtipr2 wtipr1 wtipr0 fffff17ch wtic wtif wtmk 0 0 0 wtpr2 wtpr1 wtpr0 fffff18eh pic8 pif8 pmk8 0 0 0 ppr82 ppr81 ppr80 fffff190h tp6ovic tp6ovif tp6ovmk 0 0 0 tp6ovpr2 tp6ovpr1 tp6ovpr0 fffff192h tp6ccic0 tp6ccif0 tp6ccmk0 0 0 0 tp6ccpr02 tp6ccpr01 tp6ccpr00 fffff194h tp6ccic1 tp6ccif1 tp6ccmk1 0 0 0 tp6ccpr12 tp6ccpr11 tp6ccpr10 fffff196h tp7ovic tp7ovif tp7ovmk 0 0 0 tp7ovpr2 tp7ovpr1 tp7ovpr0 fffff198h tp7ccic0 tp7ccif0 tp7ccmk0 0 0 0 tp7ccpr02 tp7ccpr01 tp7ccpr00 fffff19ah tp7ccic1 tp7ccif1 tp7ccmk1 0 0 0 tp7ccpr12 tp7ccpr11 tp7ccpr10 fffff19ch tp8ovic tp8ovif tp8ovmk 0 0 0 tp8ovpr2 tp8ovpr1 tp8ovpr0 fffff19eh tp8ccic0 tp8ccif0 tp8ccmk0 0 0 0 tp8ccpr02 tp8ccpr01 tp8ccpr00 fffff1a0h tp8ccic1 tp8ccif1 tp8ccmk1 0 0 0 tp8ccpr12 tp8ccpr11 tp8ccpr10 fffff1a2h cb5ric cb5rif cb5rmk 0 0 0 cb5rpr2 cb5rpr1 cb5rpr0 fffff1a4h cb5tic cb5tif cb5tmk 0 0 0 cb5tpr2 cb5tpr1 cb5tpr0 fffff1a6h ua3ric ua3rif ua3rmk 0 0 0 ua3rpr2 ua3rpr1 ua3rpr0 fffff1a8h ua3tic ua3tif ua3tmk 0 0 0 ua3tpr2 ua3tpr1 ua3tpr0 19.3.5 interrupt mask register s 0 to 4 (imr0 to imr4) the imr0 to imr4 registers set the interrupt mask state fo r the maskable interrupts. t he xxmkn bit of the imr0 to imr4 registers is equivalent to the xxicn.xxmkn bit. the imrm register can be read or written in 16-bit units (m = 0 to 4). if the higher 8 bits of the imrm register are used as an imrmh register and the lower 8 bits as an imrml register, these registers can be read or written in 8-bit or 1-bit units (m = 0 to 4). reset sets these registers to ffffh. caution the device file defines the xxi cn.xxmkn bit as a reserved word. if a bit is manipulated using the name of xxmkn, the contents of th e xxicn register, instead of the imrm register, are rewritten (as a result, the contents of the imrm register are also rewritten).
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 669 tp0ccmk0 pmk6 imr0 (imr0h note ) imr0l tp0ovmk pmk5 tq0ccmk3 pmk4 tq0ccmk2 pmk3 tq0ccmk1 pmk2 tq0ccmk0 pmk1 tq0ovmk pmk0 pmk7 lvimk after reset: ffffh r/w address: imr0 fffff100h, imr0l fffff100h, imr0h fffff101h after reset: ffffh r/w address: imr1 fffff102h, imr1l fffff102h, imr1h fffff103h after reset: ffffh r/w address: imr2 fffff104h, imr2l fffff104h, imr2h fffff105h tp5ccmk1 tp3ovmk imr1 (imr1h note ) imr1l tp5ccmk0 tp2ccmk1 tp5ovmk tp2ccmk0 tp4ccmk1 tp2ovmk tp4ccmk0 tp1ccmk1 tp4ovmk tp1ccmk0 tp3ccmk1 tp1ovmk tp3ccmk0 tp0ccmk1 admk cb3rmk cb3tmk tm0eqmk0 xxmkn 0 1 interrupt servicing enabled interrupt servicing disabled imr2 (imr2h note ) imr2l ua2tmk cb2tmk cb2rmk ua1tmk cb1tmk cb1rmk cb0tmk ua0tmk/ cb4tmk ua2rmk/ iicmk0 ua0rmk/ cb4rmk cb0rmk/ iicmk1 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 pmk8 imr3 (imr3h note ) imr3l 1 wtmk 1 wtimk 1 krmk 1 dmamk3 dmamk2 dmamk1 dmamk0 after reset: ffffh r/w address: imr3 fffff106h, imr3l fffff106h, imr3h fffff107h 8 1 9 1 10 1 11 12 13 14 15 1 2 3 4 5 6 7 1 0 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 0 8 9 10 11 12 13 setting of interrupt mask flag 14 15 1 2 3 4 5 6 7 0 ua1rmk/ iic2mk 1 imr4 (imr4h note ) imr4l 1 tp8ovmk 1 tp7ccmk1 ua3tmk tp7ccmk0 ua3rmk tp7ovmk tp6ccmk1 tp6ccmk0 tp6ovmk after reset: ffffh r/w address: imr4 fffff108h, imr4l fffff108h, imr4h fffff109h 8 tp8ccmk1 9 cb5rmk 10 cb5tmk 11 12 13 14 15 1 2 3 4 5 6 7 tp8ccmk0 0 note to read bits 8 to 15 of the imr0 to imr4 registers in 8-bit or 1-bit units, specify them as bits 0 to 7 of imr0h to imr4h registers. caution set bits 13 to 15 of the imr4 register and bits 7 to 14 of the imr3 register to 1. if the setting of these bits is changed, the operation is not guaranteed. remark xx: identification name of each peripheral unit (see table 19-2 interrupt control register (xxicn) ). n: peripheral unit number (see table 19-2 interrupt control register (xxicn) )
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 670 19.3.6 in-service priority register (ispr) the ispr register holds the priority level of the mask able interrupt currently acknowledged. when an interrupt request signal is acknowledged, the bit of this register corresponding to the priori ty level of that interrupt request signal is set to 1 and remains set while the interrupt is serviced. when the reti instruction is executed, the bit correspondi ng to the interrupt request signal having the highest priority is automatically reset to 0 by hardware. however, it is not reset to 0 when execution is returned from non- maskable interrupt servicing or exception processing. this register is read-only, in 8-bit or 1-bit units. reset sets this register to 00h. caution if an interrupt is acknowledged while the ispr register is being read in the interrupt enabled (ei) status, the value of the ispr register after the bits of th e register have been set by acknowledging the interrupt may be read. to accu rately read the value of the ispr register before an interrupt is acknowledged, read th e register while interrupts are disabled (di). ispr7 interrupt request signal with priority n not acknowledged interrupt request signal with priority n acknowledged isprn 0 1 priority of interrupt currently acknowledged ispr ispr6 ispr5 ispr4 ispr3 ispr2 ispr1 ispr0 after reset: 00h r address: fffff1fah <7> <6> <5> <4> <3> <2> <1> <0> remark n = 0 to 7 (priority level)
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 671 19.3.7 id flag this flag controls the maskable interrupt's operating st ate, and stores control information regarding enabling or disabling of interrupt request signals. an inte rrupt disable flag (id) is assigned to the psw. reset sets this flag to 00000020h. 0 np ep id sat cy ov s z psw maskable interrupt request signal acknowledgment enabled maskable interrupt request signal acknowledgment disabled (pending) id 0 1 specification of maskable interrupt servicing note after reset: 00000020h note interrupt disable flag (id) function this bit is set to 1 by the di instruction and cleared to 0 by the ei instruction. its value is also modified by the reti instruction or ldsr instru ction when referencing the psw. non-maskable interrupt request signals and exceptions are acknowledged regardless of this flag. when a maskable interrupt request signal is acknowledged, the id flag is automatically set to 1 by hardware. the interrupt request signal generated during the acknowledgment disabled period (id flag = 1) is acknowledged when the xxicn.xxifn bit is set to 1, and the id flag is cleared to 0. 19.3.8 watchdog timer mode register 2 (wdtm2) this register can be read or writt en in 8-bit units (for details, see chapter 11 functions of watchdog timer 2 ). reset sets this register to 67h. 0 wdtm2 wdm21 wdm20 0 0 0 0 0 after reset: 67h r/w address: fffff6d0h stops operation non-maskable interrupt request mode reset mode (initial-value) wdm21 0 0 1 wdm20 0 1 selection of watchdog timer operation mode
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 672 19.4 software exception a software exception is generated when the cpu ex ecutes the trap instruction, and can always be acknowledged. 19.4.1 operation if a software exception occurs, the cpu performs the fo llowing processing, and transfers control to the handler routine. <1> saves the restored pc to eipc. <2> saves the current psw to eipsw. <3> writes an exception code to the lower 16 bits (eicc) of ecr (interrupt source). <4> sets the psw.ep and psw.id bits to 1. <5> sets the handler address (00000040h or 00000050h ) corresponding to the software exception to the pc, and transfers control. the processing of a software exception is shown below. figure 19-9. software exception processing trap instruction eipc eipsw ecr.eicc psw.ep psw.id pc restored pc psw exception code 1 1 handler address cpu processing exception processing note note trap instruction format: trap vector (t he vector is a value from 00h to 1fh.) the handler address is determined by the trap instruction' s operand (vector). if the vector is 00h to 0fh, it becomes 00000040h, and if the vector is 10h to 1fh, it becomes 00000050h.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 673 19.4.2 restore recovery from software exception processing is carried out by the reti instruction. by executing the reti instruction, t he cpu carries out the following processi ng and shifts control to the restored pc's address. <1> loads the restored pc and psw from ei pc and eipsw because the psw.ep bit is 1. <2> transfers control to the address of the restored pc and psw. the processing of the reti instruction is shown below. figure 19-10. reti instruction processing psw.ep reti instruction pc psw eipc eipsw psw.np original processing restored pc psw fepc fepsw 1 1 0 0 caution when the ep and np bits are changed by the ldsr instruction during the software exception processing, in order to restore the pc and psw correctly during recovery by the reti instruction, it is necessary to set the ep bit back to 1 and the np bit back to 0 using the ldsr instruction immediately befo re the reti instruction. remark the solid line shows the cpu processing flow.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 674 19.4.3 ep flag the ep flag is a status flag used to indica te that exception processing is in progress. it is set when an exception occurs. 0 np ep id sat cy ov s z psw exception processing not in progress. exception processing in progress. ep 0 1 exception processing status after reset: 00000020h
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 675 19.5 exception trap an exception trap is an interrupt that is requested when the illegal execution of an instruction takes place. in the v850es/jj2, an illegal opcode exception (ilgop: illegal opcode trap) is considered as an exception trap. 19.5.1 illegal opcode definition the illegal instruction has an opcode (bits 10 to 5) of 111111b, a sub-opcode (bits 26 to 23) of 0111b to 1111b, and a sub-opcode (bit 16) of 0b. an exception trap is generated when an instruction applicable to this illegal instruction is executed. 15 16 23 22 xxxxxx0 x x x x x x x x x x 1 1 1 1 1 1 x x x x x 27 26 31 0 4 5 10 11 1 1 1 1 1 1 0 1 to x: arbitrary caution since it is possible to assign this instruction to an illegal opcode in the future, it is recommended that it not be used. (1) operation if an exception trap occurs, the cpu performs the followi ng processing, and transfers control to the handler routine. <1> saves the restored pc to dbpc. <2> saves the current psw to dbpsw. <3> sets the psw.np, psw.ep, and psw.id bits to 1. <4> sets the handler address (00000060h) correspondi ng to the exception trap to the pc, and transfers control. the processing of the exc eption trap is shown below. figure 19-11. exception trap processing exception trap (ilgop) occurs dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h exception processing cpu processing
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 676 (2) restore recovery from an exception trap is carried out by the dbret instruction. by executing the dbret instruction, the cpu carries out the following proce ssing and controls the address of the restored pc. <1> loads the restored pc and psw from dbpc and dbpsw. <2> transfers control to the address indicated by the restored pc and psw. caution dbpc and dbpsw can be accessed only durin g the interval between the execution of an illegal opcode and the dbret instruction. the restore processing from an exception trap is shown below. figure 19-12. restore processing from exception trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 677 19.5.2 debug trap a debug trap is an exception that is generated w hen the dbtrap instruction is executed and is always acknowledged. (1) operation upon occurrence of a debug trap, the cpu performs the following processing. <1> saves restored pc to dbpc. <2> saves current psw to dbpsw. <3> sets the psw.np, psw.ep, and psw.id bits to 1. <4> sets handler address (00000060h) for debug trap to pc and transfers control. the debug trap processing format is shown below. figure 19-13. debug trap processing format dbtrap instruction dbpc dbpsw psw.np psw.ep psw.id pc restored pc psw 1 1 1 00000060h exception processing cpu processing
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 678 (2) restoration restoration from a debug trap is exec uted with the dbret instruction. with the dbret instruction, the cpu performs the follo wing steps and transfers control to the address of the restored pc. <1> the restored pc and psw are read from dbpc and dbpsw. <2> control is transferred to the fetc hed address of the restored pc and psw. caution dbpc and dbpsw can be accessed only duri ng the interval between the execution of the dbtrap instruction and the dbret instruction. the processing format for restoration from a debug trap is shown below. figure 19-14. processing format of restoration from debug trap dbret instruction pc psw dbpc dbpsw jump to address of restored pc
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 679 19.6 external interrupt request input pins (nmi and intp0 to intp8) 19.6.1 noise elimination (1) eliminating noise on nmi pin the nmi pin has an internal noise elimination circuit that uses analog delay. therefor e, the input level of the nmi pin is not detected as an edge unless it is maintained for a specific time or longer. therefore, an edge is detected after specific time. the nmi pin can be used to release the stop mode. in the stop mode, noise is not eliminated by using the system clock because the internal system clock is stopped. (2) eliminating noise on intp0 to intp8 pins the intp0 to intp8 pins have an internal noise eliminatio n circuit that uses analog delay. therefore, the input level of the nmi pin is not detected as an edge unless it is maintained for a specific time or longer. therefore, an edge is detected after specific time. 19.6.2 edge detection the valid edge of each of the nmi and intp0 to in tp8 pins can be selected from the following four. ? rising edge ? falling edge ? both rising and falling edges ? no edge detected the edge of the nmi pin is not detected after reset. therefore, the interrupt request signal is not acknowledged unless a valid edge is enabled by using the intf0 and intr0 register (the nmi pin functions as a normal port pin).
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 680 (1) external interrupt fallin g, rising edge specification register 0 (intf0, intr0) the intf0 and intr0 registers are 8-bit registers that specify detection of the falling and rising edges of the nmi pin via bit 2 and the external interrupt pins (intp0 to intp3) via bits 3 to 6. these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. caution when the function is changed from the extern al interrupt function (alternate function) to the port function, an edge may be detected. there fore, clear the intf0n and intr0n bits to 00, and then set the port mode. 0 intf0 intf06 intp3 intf05 intf04 intf03 intf02 0 0 after reset: 00h r/w address: intf0 fffffc00h, intr0 fffffc20h 0 intr0 intr06 intr05 intr04 intr03 intr02 0 0 intp2 intp1 intp0 nmi intp3 intp2 intp1 intp0 nmi remark for how to specify a valid edge, see table 19-3 . table 19-3. valid edge specification intf0n intr0n valid edge specification (n = 2 to 6) 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf0 n and intr0n bits to 00 when these registers are not used as the nmi or intp0 to intp3 pins. remark n = 2: control of nmi pin n = 3 to 6: control of intp0 to intp3 pins
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 681 (2) external interrupt fallin g, rising edge specification register 3 (intf3, intr3) the intf3 and intr3 registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pin (intp7). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. cautions 1. when the function is changed from the external interrupt function (alternate function) to the port function, an edge may be detected. therefore, clear the intf31 and intr31 bits to 00, and then set the port mode. 2. the intp7 pin and rxda0 pin are alternat e-function pins. when using the pin as the rxda0 pin, disable edge detection for th e intp7 alternate-function pin (clear the intf3.intf31 bit and the inrt3.intr31 bit to 0) . when using the pin as the intp7 pin, stop uarta0 reception (clear the ua0ctl0.ua0rxe bit to 0). intf3 after reset: 00h r/w address: intf3 fffffc06h, intr3 fffffc26h 0 0 0 0 0 0 intf31 0 intr3 0 0 0 0 0 0 intr31 0 intp7 intp7 remark for how to specify a valid edge, see table 19-4 . table 19-4. valid edge specification intf31 intr31 valid edge specification 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf31 and intr31 bits to 00 when these re gisters are not used as intp7 pin.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 682 (3) external interrupt fallin g, rising edge specification register 8 (intf8, intr8) the intf8 and intr8 registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pin (intp8). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. cautions 1. when the function is changed from the external interrupt function (alternate function) to the port function, an edge may be detected. therefore, clear the intf80 and intr80 bits to 00, and then set the port mode. 2. the intp8 pin and rxda3 pin are alternat e-function pins. when using the pin as the rxda3 pin, disable edge detection for th e intp8 alternate-function pin (clear the intf8.intf80 bit and the intr8.intr80 bit to 0) . when using the pin as the intp8 pin, stop uarta3 reception (clear the ua3ctl0.ua3rxe bit to 0). intf8 after reset: 00h r/w address: intf8 fffffc10h, intr8 fffffc30h 0 0 0 0 0 0 0 intf80 intr8 0 0 0 0 0 0 0 intr80 intp8 intp8 remark for how to specify a valid edge, see table 19-5 . table 19-5. valid edge specification intf80 intr80 valid edge specification 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf80 and intr80 bits to 00 when these re gisters are not used as intp8 pin.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 683 (4) external interrupt fallin g, rising edge specification re gister 9h (intf9h, intr9h) the intf9h and intr9h registers are 8-bit registers that specify detection of the falling and rising edges of the external interrupt pins (intp4 to intp6). these registers can be read or written in 8-bit or 1-bit units. reset sets these registers to 00h. caution when the function is changed from the extern al interrupt function (alternate function) to the port function, an edge may be detected. there fore, clear the intf9n and intr9n bits to 0, and then set the port mode. intf9h after reset: 00h r/w address: intf9h fffffc13h, intr9h fffffc33h intf915 intf914 intf913 0 0 0 0 0 8 9 10 11 12 13 14 15 intr9h intr915 intr914 intr913 0 0 0 0 0 8 9 10 11 12 13 14 15 intp6 intp5 intp4 intp6 intp5 intp4 remark for how to specify a valid edge, see table 19-6 . table 19-6. valid edge specification intf9n intr9n valid edge specification (n = 13 to 15) 0 0 no edge detected 0 1 rising edge 1 0 falling edge 1 1 both rising and falling edges caution be sure to clear the intf9n and intr9n bits to 00 when these re gisters are not used as intp4 to intp6 pins. remark n = 13 to 15: control of intp4 to intp6 pins
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 684 (5) noise elimination control register (nfc) digital noise elimination can be selected for the intp3 pin. the noise elimination settings are performed using the nfc register. when digital noise elimination is selected, the sampling clock for digital sampling can be selected from among f xx /64, f xx /128, f xx /256, f xx /512, f xx /1,024, and f xt . sampling is performed three times. when digital noise elimination is selected, if the cloc k that performs sampling in the standby mode is stopped, then the intp3 interrupt request signal cannot be used for releasing the standby mode. when f xt is used as the sampling clock, the intp3 interrupt request signal can be used for releasing either the subclock operating mode or the idle1/idle2/stop/sub-idle mode. this register can be read or written in 8-bit units. reset sets this register to 00h. caution after the sampling clock has been changed, it takes 3 sampling clocks to initialize the digital noise eliminator. therefore, if an intp3 valid edge is input within these 3 sampling clocks after the sampling clock has been changed, an interrupt request signal may be generated. therefore, be careful about the following points when using the interrupt and dma functions. ? when using the interrupt function, after the 3 sampling clocks have elapsed, enable interrupts after the interrupt request flag (pic3.pif3 bit) has been cleared. ? when using the dma function (started by intp3), enable dma after 3 sampling clocks have elapsed. nfen nfc 0 0 0 0 nfc2 nfc1 nfc0 f xx /64 f xx /128 f xx /256 f xx /512 f xx /1,024 f xt (subclock) nfc2 0 0 0 0 1 1 digital sampling clock setting prohibited nfc1 0 0 1 1 0 0 nfc0 0 1 0 1 0 1 after reset: 00h r/w address: fffff318h analog noise elimination (60 ns (typ.)) digital noise elimination nfen 0 1 settings of intp3 pin noise elimination other than above remarks 1. since sampling is performed three times, the reliably eliminated noise width is 2 sampling clocks. 2. in the case of noise with a width smaller than 2 sampling clocks, an interrupt request signal is generated if noise synchronized with the sampling clock is input.
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 685 19.7 interrupt acknowledge time of cpu except the following cases, the interrupt acknowledge time of the cpu is 4 clocks minimum. to input interrupt request signals successively, input the next interrupt req uest signal at least 5 clocks after the preceding interrupt. ? in idle1/idle2/stop mode ? when the external bus is accessed ? when interrupt request non-sampling instructions are successively executed (see 19.8 periods in which interrupts are not acknowledged by cpu .) ? when the interrupt control register is accessed figure 19-15. pipeline operation at interr upt request signal acknowledgment (outline) (1) minimum interrupt response time if id ex internal clock instruction 1 instruction 2 interrupt acknowledgment operation instruction (first instruction of interrupt servicing routine) interrupt request if id ex mem wb ifx idx int1 int2 int3 int4 4 system clocks (2) maximum interrupt response time if id ex internal clock instruction 1 instruction 2 interrupt acknowledgment operation instruction (first instruction of interrupt servicing routine) interrupt request if id ex mem mem mem wb ifx idx int1 int2 int3 int3 int3 int4 6 system clocks remark int1 to int4: interrupt acknowledgment processing ifx: invalid instruction fetch idx: invalid instruction decode interrupt acknowledge time (internal system clock) internal interrupt external interrupt condition minimum 4 4 + analog delay time maximum 6 6 + analog delay time the following cases are exceptions. ? in idle1/idle2/stop mode ? external bus access ? two or more interrupt request non-sample instructions are executed in succession ? access to peripheral i/o register
chapter 19 interrupt/exception processing function preliminary user's manual u17714ej1v0ud 686 19.8 periods in which interrupts are not acknowledged by cpu an interrupt is acknowledged by the cpu while an instru ction is being executed. however, no interrupt will be acknowledged between an interrupt request non-sample instructi on and the next instruction (int errupt is held pending). the interrupt request non-sample instructions are as follows. ? ei instruction ? di instruction ? ldsr reg2, 0x5 instruction (for psw) ? the store instruction for the prcmd register ? the store, set1, not1, or clr1 inst ructions for the following registers. ? interrupt-related registers: interrupt control register (xxicn), interr upt mask registers 0 to 4 (imr0 to imr4) ? power save control register (psc) ? on-chip debug mode register (ocdm) remark xx: identification name of each peripheral unit (see table 19-2 interrupt control register (xxicn) ) n: peripheral unit number (see table 19-2 interrupt control register (xxicn) ). 19.9 cautions the nmi pin and p02 pin are an alternat e-function pin, and function as a normal port pin after being reset. to enable the nmi pin, validate the nmi pin with the pmc0 register. the initial setting of the nmi pin is "no edge detected". select the nmi pin valid edge using the intf0 and intr0 registers.
preliminary user's manual u17714ej1v0ud 687 chapter 20 key interrupt function 20.1 function a key interrupt request signal (intkr) can be generated by inputting a falling edge to the eight key input pins (kr0 to kr7) by setting the krm register. table 20-1. assignment of key return detection pins flag pin description krm0 controls kr0 signal in 1-bit units krm1 controls kr1 signal in 1-bit units krm2 controls kr2 signal in 1-bit units krm3 controls kr3 signal in 1-bit units krm4 controls kr4 signal in 1-bit units krm5 controls kr5 signal in 1-bit units krm6 controls kr6 signal in 1-bit units krm7 controls kr7 signal in 1-bit units figure 20-1. key re turn block diagram intkr key return mode register (krm) krm7 krm6 krm5 krm4 krm3 krm2 krm1 krm0 kr7 kr6 kr5 kr4 kr3 kr2 kr1 kr0
chapter 20 key interrupt function preliminary user's manual u17714ej1v0ud 688 20.2 register (1) key return mode register (krm) the krm register controls the krm0 to krm7 bits using the kr0 to kr7 signals. this register can be read or writt en in 8-bit or 1-bit units. reset sets this register to 00h. krm7 does not detect key return signal detects key return signal krmn 0 1 control of key return mode krm krm6 krm5 krm4 krm3 krm2 krm1 krm0 after reset: 00h r/w address: fffff300h caution rewrite the krm register after once clearing the krm register to 00h. remark for the alternate-function pin settings, see table 4-19 using port pin as alternate- function pin . 20.3 cautions (1) if a low level is input to any of the kr0 to kr7 pins , the intkr signal is not generated even if the falling edge of another pin is input. (2) the rxda1 and kr7 pins must not be used at the same time. to use the rxda1 pin, do not use the kr7 pin. to use the kr7 pin, do not use the rxda1 pin (it is recommended to set the pfc91 bit to 1 and clear pfce91 bit to 0). (3) if the krm register is changed, an interrupt reques t signal (intkr) may be generated. to prevent this, change the krm register after disabling interrupts (di) or masking, then clear the interrupt request flag (kric.krif bit) to 0, and enable interrupts (ei) or clear the mask. (4) to use the key interrupt function, be sure to set the po rt pin to the key return pin and then enable the operation with the krm register. to switch from the key return pin to the port pin, disable the operation with the krm register and then set the port pin.
preliminary user's manual u17714ej1v0ud 689 chapter 21 standby function 21.1 overview the power consumption of the system can be effectively reduced by using the standby modes in combination and selecting the appropriate mode for the application. the available stan dby modes are listed in table 21-1. table 21-1. standby modes mode functional outline halt mode mode in which only the operating clock of the cpu is stopped idle1 mode mode in which all the operations of the internal circuits except the oscillator, pll note , and flash memory are stopped idle2 mode mode in which all the operations of internal circuits except the oscillator are stopped stop mode mode in which all the operations of internal circuits except the subclock oscillator are stopped subclock operation mode mode in which the subclock is used as the internal system clock sub-idle mode mode in which all the operations of internal circuits except the oscillator are stopped, in the subclock operation mode note the pll holds the prev ious operating status.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 690 figure 21-1. status transition reset subclock operation mode (fx operates, pll operates) subclock operation mode (fx stops, pll stops) sub-idle mode (fx operates, pll operates) sub-idle mode (fx stops, pll stops) stop mode (fx stops, pll stops) idle2 mode (fx operates, pll stops) idle1 mode (fx operates, pll operates) idle1 mode (fx operates, pll stops) halt mode (fx operates, pll stops) halt mode (fx operates, pll operates) normal operation mode oscillation stabilization wait clock through mode (pll operates) clock through mode (pll stops) pll mode (pll operates) internal oscillation clock operation wdt overflow oscillation stabilization wait note pll lockup time wait oscillation stabilization wait note oscillation stabilization wait note note if a wdt overflow occurs during an oscillation stabilization time, the cpu operates on the internal oscillation clock. remark f x : main clock
chapter 21 standby function preliminary user's manual u17714ej1v0ud 691 21.2 registers (1) power save control register (psc) the psc register is an 8-bit register t hat controls the standby function. the stp bit of this register is used to specify the stop mode. this regist er is a special register that can be written only by the special sequence combinations (see 3.4.7 special registers ). this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 idle1, sub-idle modes stop, sub-idle modes idle2, sub-idle modes stop mode psm1 0 0 1 1 specification of operation in software standby mode psmr 0 0 0 0 0 psm1 psm0 after reset: 00h r/w address: fffff820h psm0 0 1 0 1 < > < > note standby mode set by stp bit: idle1, idle2, stop, or sub-idle mode cautions 1. before setting the idle1, idle2, stop, or sub-idle mode, set the psmr.psm1 and psmr.psm0 bits and then set the stp bit. 2. settings of the nmi1m, nmi0m, and in tm bits are invalid when halt mode is released.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 692 (2) power save mode register (psmr) the psmr register is an 8-bit register that controls the opera tion status in the power save mode and the clock operation. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. 0 idle1, sub-idle modes stop, sub-idle modes idle2, sub-idle modes stop mode psm1 0 0 1 1 specification of operation in software standby mode psmr 0 0 0 0 0 psm1 psm0 after reset: 00h r/w address: fffff820h psm0 0 1 0 1 < > < > cautions 1. be sure to cl ear bits 2 to 7 to ?0?. 2. the psm0 and psm1 bits are valid only when the psc.stp bit is 1. remark idle1: in this mode, all operations except the oscillator operation and some other circuits (flash memory and pll) are stopped. after the idle1 mode is released, the norma l operation mode is restored without needing to secure the oscillation stabilization time, like the halt mode. idle2: in this mode, all operations ex cept the oscillator operation are stopped. after the idle2 mode is released, the nor mal operation mode is restored following the lapse of the setup time specified by t he osts register (flash memory and pll). stop: in this mode, all operations except the subclock oscillator operation are stopped. after the stop mode is released, the nor mal operation mode is restored following the lapse of the oscillation stabilization time specified by the osts register. sub-idle: in this mode, all other operations are halte d except for the oscillator. after the idle mode has been released by the interrupt request signal, the subclock operation mode will be restored after 12 cycles of the subclock have been secured.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 693 (3) oscillation stabilization time select register (osts) the wait time until the oscillation st abilizes after the stop mode is releas ed or the wait time until the on-chip flash memory stabilizes after the idle2 mode is released is controlled by the osts register. the osts register can be read or written 8-bit units. reset sets this register to 06h. 0 osts 0 0 0 0 osts2 osts1 osts0 osts2 0 0 0 0 1 1 1 1 selection of oscillation stabilization time/setup time note osts1 0 0 1 1 0 0 1 1 osts0 0 1 0 1 0 1 0 1 after reset: 06h r/w address: fffff6c0h 2 10 /f x 2 11 /f x 2 12 /f x 2 13 /f x 2 14 /f x 2 15 /f x 2 16 /f x 4 mhz 0.256 ms 0.512 ms 1.024 ms 2.048 ms 4.096 ms 8.192 ms 16.38 ms 5 mhz 0.205 ms 0.410 ms 0.819 ms 1.638 ms 3.277 ms 6.554 ms 13.107 ms f x setting prohibited note the oscillation stabilization time and set up time are required when the stop mode and idle2 mode are released, respectively. cautions 1. the wait time following release of the stop mode does not include the time until the clock oscillation starts ("a" in the figure below) following release of the stop mode, regardless of whether th e stop mode is released by reset or the occurrence of an in terrupt request signal. a stop mode release voltage waveform of x1 pin v ss 2. be sure to clear bits 3 to 7 to ?0?. 3. the oscillation stabilization ti me following reset release is 2 16 /f x (because the initial value of the osts register = 06h). remark f x = main clock oscillation frequency
chapter 21 standby function preliminary user's manual u17714ej1v0ud 694 21.3 halt mode 21.3.1 setting and operation status the halt mode is set when a dedicated instruction (halt) is executed in the normal operation mode. in the halt mode, the clock oscillator continues operating. only clock s upply to the cpu is stopped; clock supply to the other on-chip peripheral functions continues. as a result, program execution is stopped, and the inte rnal ram retains the contents before the halt mode was set. the on-chip peripheral functions that are independent of instruction processing by the cpu continue operating. table 21-3 shows the operating status in the halt mode. the average current consumpt ion of the system can be reduced by usi ng the halt mode in combination with the normal operation mode for intermittent operation. cautions 1. insert five or more nop in structions after the halt instruction. 2. if the halt instruction is executed while an unmasked interrupt request signal is being held pending, the status shifts to halt mode, but th e halt mode is then released immediately by the pending interrupt request. 21.3.2 releasing halt mode the halt mode is released by a non-maskable interrupt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from a peripheral function operable in t he halt mode, or reset signal (reset by reset pin input, wdt2res signal, low-voltage detector (lvi), or clock monitor (clm)). after the halt mode has been released, the normal operation mode is restored. (1) releasing halt mode by non-m askable interrupt request signal or unmasked maskable interrupt request signal the halt mode is released by a non-maskable interrupt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the halt mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the halt mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt req uest signal), the halt mode is released and that interrupt request signal is acknowledged. table 21-2. operation after releasing ha lt mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 695 (2) releasing halt mode by reset the same operation as the normal reset operation is performed. table 21-3. operating status in halt mode setting of halt mode operating status item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll operable cpu stops operation dma operable interrupt controller operable timer p (tmp0 to tmp8) operable timer q (tmq0) operable timer m (tmm0) operable when a clock other than f xt is selected as the count clock operable watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when a clock other than f xt is selected as the count clock operable csib0 to csib5 operable i 2 c00 to i 2 c02 operable serial interface uarta0 to uarta3 operable a/d converter operable d/a converter operable real-time output function (rto) operable key interrupt function (kr) operable external bus interface see 2.2 pin states . port function retains status before halt mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the halt mode was set.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 696 21.4 idle1 mode 21.4.1 setting and operation status the idle1 mode is set by clearing the psmr.psm1 and psmr .psm0 bits to 00 and setting the psc.stp bit to 1 in the normal operation mode. in the idle1 mode, the clock oscillator, pll, and flash me mory continue operating but clock supply to the cpu and other on-chip peripheral functions stops. as a result, program execution stops and the contents of the internal ram before the idle1 mode was set are retained. the cpu and other on-chip peripheral functions st op operating. however, the on- chip peripheral functions that can operate with the subclock or an external clock continue operating. table 21-5 shows the operating status in the idle1 mode. the idle1 mode can reduce the power consumption more than the halt mode because it stops the operation of the on-chip peripheral functions. the main clock osc illator does not stop, so t he normal operation mode can be restored without waiting for the oscillation stabilization ti me after the idle1 mode has been released, in the same manner as when the halt mode is released. cautions 1. insert five or more nop instructions after the instruction th at stores data in the psc register to set the idle1 mode. 2. if the idle1 mode is set while an unmasked interrupt request signal is being held pending, the idle1 mode is released immediat ely by the pending interrupt request. 21.4.2 releasing idle1 mode the idle1 mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from a peripheral function operable in the idle1 mode, or reset signal (reset by reset pin input, wdt2res signal, low-voltage detector (lvi), or clock monitor (clm)). after the idle1 mode has been released, the normal operation mode is restored. (1) releasing idle1 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal the idle1 mode is released by a non-maskable interr upt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the idle1 mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is processed as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the idle1 mode is releas ed, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt r equest signal), the idle1 mode is released and that interrupt request signal is acknowledged. caution an interrupt request signal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and idle1 mode is not released.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 697 table 21-4. operation after releasing id le1 mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed. (2) releasing idle1 mode by reset the same operation as the normal reset operation is performed. table 21-5. operating status in idle1 mode setting of idle1 mode operating status item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll operable cpu stops operation dma stops operation interrupt controller stops operation (but standby mode release is possible) timer p (tmp0 to tmp8) stops operation timer q (tmq0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) a/d converter holds operation (conversion result held) note d/a converter holds operation (output held note ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable external bus interface see 2.2 pin states . port function retains status before idle1 mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the idle1 mode was set. note to realize low power consumption, stop the a/d converter and d/a converte r before shifting to the idle1 mode.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 698 21.5 idle2 mode 21.5.1 setting and operation status the idle2 mode is set by setting the psmr.psm1 and psmr. psm0 bits to 10 and setting the psc.stp bit to 1 in the normal operation mode. in the idle2 mode, the clock oscillator continues operatio n but clock supply to the cpu, pll, flash memory, and other on-chip peripheral functions stops. as a result, program execution stops and the contents of the internal ram before the idle2 mode was set are retained. the cpu, pll, and other on-chip peripheral functions stop operating. however, the on-chip peripheral functions that can operate with the subclock or an extern al clock continue operating. table 21-7 shows the operating status in the idle2 mode. the idle2 mode can reduce the power consumption more t han the idle1 mode because it stops the operations of the on-chip peripheral functions, pll, and flash memory. however, because the pll and flash memory are stopped, a setup time for the pll and flash memory is required when idle2 mode is released. cautions 1. insert five or more nop instructions after the instruction th at stores data in the psc register to set the idle2 mode. 2. if the idle2 mode is set while an unmasked interrupt request signal is being held pending, the idle2 mode is released immediat ely by the pending interrupt request. 21.5.2 releasing idle2 mode the idle2 mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operable in the idle2 mode, or reset signal (reset by reset pin input, wdt2res signal, low-voltage detector (lvi), or clock monitor (clm)). the pll returns to the operat ing status it was in before the idle2 mode was set. after the idle2 mode has been released, the normal operation mode is restored. (1) releasing idle2 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal the idle2 mode is released by a non-maskable interr upt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the idle2 mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is processed as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the idle2 mode is rel eased, but that interrupt request si gnal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt request currently being serviced is issued (including a non-maskable interrupt request signal), the idle2 mode is released and that interrupt request signal is acknowledged. caution the interrupt request signal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and idle2 mode is not released.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 699 table 21-6. operation after releasing id le2 mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address after securing the prescribed setup time. maskable interrupt request signal execution branches to the handler address or the next instruction is executed after securing the prescribed setup time. the next instruction is executed after securing the prescribed setup time. (2) releasing idle2 mode by reset the same operation as the normal reset operation is performed. table 21-7. operating status in idle2 mode setting of idle2 mode operating status item when subclock is not used when subclock is used main clock oscillator oscillation enabled subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll stops operation cpu stops operation dma stops operation interrupt controller stops operation (but standby mode release is possible) timer p (tmp0 to tmp8) stops operation timer q (tmq0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer operable when f x (divided brg) is selected as the count clock operable watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) a/d converter holds operation (conversion result held) note d/a converter holds operation (output held note ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable external bus interface see 2.2 pin states . port function retains status before idle2 mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the idle2 mode was set. note to realize low power consumption, stop the a/d converter and d/a converte r before shifting to the idle2 mode.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 700 21.5.3 securing setup time when releasing idle2 mode secure the setup time for the flash memory after releasing the idle2 mode because the operation of the blocks other than the main clock oscillator stops after the idle2 mode is set. (1) releasing idle2 mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal secure the specified setup time by setting the osts register. when the releasing source is generated, the dedicated in ternal timer starts counting according to the osts register setting. when it overflows, the normal operation mode is restored. oscillated waveform rom circuit stopped setup time count main clock idle mode status interrupt request (2) release by reset (reset pin input, wdt2r es generation) this operation is the same as that of a normal reset. the oscillation stabilization time is the initial value of the osts register, 2 16 /f x .
chapter 21 standby function preliminary user's manual u17714ej1v0ud 701 21.6 stop mode 21.6.1 setting and operation status the stop mode is set by setting the psmr.psm1 and psmr .psm0 bits to 01 or 11 and setting the psc.stp bit to 1 in the normal operation mode. in the stop mode, the subclock oscillat or continues operating but the main cl ock oscillator stops. clock supply to the cpu and the on-chip peri pheral functions is stopped. as a result, program execution stops , and the contents of the internal ram before the stop mode was set are retained. the on-chip peripheral functi ons that operate with the clock oscillat ed by the subclock oscillator or an external clock continue operating. table 21-9 shows the operating status in the stop mode. because the stop mode stops operation of the main clock oscillator, it reduc es the power consumption to a level lower than the idle2 mode. if the subclock oscillator, inte rnal oscillator, and external clock are not used, the power consumption can be minimized with only leakage current flowing. cautions 1. insert five or more nop instructions after the instruction th at stores data in the psc register to set the stop mode. 2. if the stop mode is set while an unmasked interrupt request signal is being held pending, the stop mode is released immediatel y by the pending interrupt request. 21.6.2 releasing stop mode the stop mode is released by a non-maskable interr upt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operable in the stop mode, or reset signal (reset by reset pin input, wdt2res signal, or low-voltage detector (lvi)). after the stop mode has been released, the normal operation mode is restor ed after the oscillation stabilization time has been secured. (1) releasing stop mode by non-maskable interr upt request signal or unmasked maskable interrupt request signal the stop mode is released by a non-maskable interru pt request signal or an unmasked maskable interrupt request signal, regardless of the priority of the interrupt request signal. if the stop mode is set in an interrupt servicing routine, however, an interrupt request si gnal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the stop mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt reques t signal), the stop mode is released and that interrupt request signal is acknowledged. caution the interrupt request that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and stop mode is not released.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 702 table 21-8. operation after releasing st op mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address after securing the oscillation stabilization time. maskable interrupt request signal execution branches to the handler address or the next instruction is executed after securing the oscillation stabilization time. the next instruction is executed after securing the oscillation stabilization time.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 703 (2) releasing stop mode by reset the same operation as the normal reset operation is performed. table 21-9. operating status in stop mode setting of stop mode operating status item when subclock is not used when subclock is used main clock oscillator stops oscillation subclock oscillator ? oscillation enabled internal oscillator oscillation enabled pll stops operation cpu stops operation dma stops operation interrupt controller stops operation (but standby mode release is possible) timer p (tmp0 to tmp8) stops operation timer q (tmq0) stops operation timer m (tmm0) operable when f r /8 is selected as the count clock operable when f r /8 or f xt is selected as the count clock watch timer stops operation operable when f xt is selected as the count clock watchdog timer 2 operable when f r is selected as the count clock operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) a/d converter stops operation (conversion result undefined) notes 1, 2 d/a converter stops operation notes 3, 4 (high impedance is output) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable external bus interface see 2.2 pin states . port function retains status before stop mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the stop mode was set. notes 1. if the stop mode is set while the a/d converter is operating, the a/d converte r is automatically stopped and starts operating again after the stop mode is rel eased. however, in that case, the a/d conversion results after the stop mode is released are invalid. all the a/d conversion results before the stop mode is set are invalid. 2. even if the stop mode is set while the a/d converte r is operating, the power consumption is reduced equivalently to when the a/d converter is stopped before the stop mode is set. 3. if the stop mode is set while the d/a converter is operating, the d/a converte r is automatically stopped and the pin status becomes high impedance. after the stop mode is released, d/a conversion resumes, the setting time elapses, and the status re turns to the output level before the stop mode was set. 4. even if the stop mode is set while the d/a converte r is operating, the power consumption is reduced equivalently to when the d/a converter is stopped before the stop mode is set.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 704 21.6.3 securing oscillation stabilizati on time when releasing stop mode secure the oscillation stabilization time for the main clo ck oscillator after releasing the stop mode because the operation of the main clock oscillator stops after stop mode is set. (1) releasing stop mode by non-maskable inte rrupt request signal or unmasked maskable interrupt request signal secure the oscillation stabilization time by setting the osts register. when the releasing source is generated, the dedicated in ternal timer starts counting according to the osts register setting. when it overflows, the normal operation mode is restored. oscillated waveform rom circuit stopped setup time count main clock stop status interrupt request (2) release by reset this operation is the same as that of a normal reset. the oscillation stabilization time is the initial value of the osts register, 2 16 /f x .
chapter 21 standby function preliminary user's manual u17714ej1v0ud 705 21.7 subclock operation mode 21.7.1 setting and operation status the subclock operation mode is set by setting the pcc.ck3 bit to 1 in the normal operation mode. when the subclock operation mode is set, t he internal system clock is changed from the main clock to the subclock. check whether the clock has been s witched by using the pcc.cls bit. when the pcc.mck bit is set to 1, the operation of the main clock oscillator is stopped. as a result, the system operates only on the subclock. in the subclock operation mode, the power consumption can be reduced to a level lower than in the normal operation mode because the subclock is us ed as the internal system clock. in addition, the power consumption can be further reduced to the level of the stop mode by st opping the operation of t he main clock oscillator. table 21-10 shows the operating st atus in subclock operation mode. cautions 1. when manipulating the ck3 bit, do not ch ange the set values of the pcc.ck2 to pcc.ck0 bits (using a bit manipulation instruction to manipul ate the bit is recommended). for details of the pcc register, see 6.3 (1) pro cessor clock control register (pcc). 2. if the following conditions are not satisfied, ch ange the ck2 to ck0 bits so that the conditions are satisfied and set the subclock operation mode. internal system clock (f clk ) > subclock (f xt = 32.768 khz) 4 remark internal system clock (f clk ): clock generated from main clock (f xx ) in accordance with the settings of the ck2 to ck0 bits 21.7.2 releasing subc lock operation mode the subclock operation mode is released by a reset signal (reset by reset pin input, wdt2res signal, low- voltage detector (lvi), or clock monitor (c lm)) when the ck3 bit is cleared to 0. if the main clock is stopped (mck bit = 1), set the mck bit to 1, secure the oscillation stabilization time of the main clock by software, and clear the ck3 bit to 0. the normal operation mode is restored when the subclock operation mode is released. caution when manipulating the ck3 bit, do not change the set values of the ck2 to ck0 bits (using a bit manipulation instruction to manipulate the bit is recommended). for details of the pcc register, see 6.3 (1 ) processor clock control register (pcc).
chapter 21 standby function preliminary user's manual u17714ej1v0ud 706 table 21-10. operating status in subclock operation mode operating status setting of subclock operation mode item when main clock is oscillating when main clock is stopped subclock oscillator oscillation enabled internal oscillator oscillation enabled pll operable stops operation note cpu operable dma operable interrupt controller operable timer p (tmp0 to tmp8) operable stops operation timer q (tmq0) operable stops operation timer m (tmm0) operable operable when f r /8 or f xt is selected as the count clock watch timer operable operable when f xt is selected as the count clock watchdog timer 2 operable operable when f r or f xt is selected as the count clock csib0 to csib5 operable operable when the sckbn input clock is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 operable stops operation serial interface uarta0 to uarta3 operable stops operation (but uarta0 is operable when the ascka0 input clock is selected) a/d converter operable stops operation d/a converter operable real-time output function (rto) oper able stops operation (output held) key interrupt function (kr) operable external bus interface see 2.2 pin states . port function settable internal data settable note be sure to stop the pll (pllctl.pllon bi t = 0) before stopping the main clock. caution when the cpu is operati ng on the subclock and main cloc k oscillation is stopped, accessing a register in which a wait occurs is disabled. if a wait is generated, it can be released only by reset (see 3.4.8 (2)).
chapter 21 standby function preliminary user's manual u17714ej1v0ud 707 21.8 sub-idle mode 21.8.1 setting and operation status the sub-idle mode is set by setting the psmr.psm1 a nd psmr.psm0 bits to 00 or 10 and setting the psc.stp bit to 1 in the subclock operation mode. in this mode, the clock oscillator c ontinues operating but clock supply to the cpu, flash memory, and the other on- chip peripheral functions is stopped. as a result, program execution stops and the contents of the internal ram before the sub-idle mode was set are retained. the cpu and the other on-chip peripheral functions are stopped. however, the on-chip peripheral functions that can operate with the subclock or an external clock continue operating. because the sub-idle mode stops oper ation of the cpu, flash memory, and ot her on-chip peripheral functions, it can reduce the power consumption more than the subclock operation mode. if the sub-idle mode is set after the main clock has been stopped, the current consumption can be reduced to a level as low as that in the stop mode. table 21-12 shows the operating status in the sub-idle mode. cautions 1. following the store inst ruction to set the psc register to the sub-idle mode, insert the five or more nop instructions. 2. if the sub-idle mode is set while an unmasked interrupt request signal is being held pending, the sub-idle mode is then released immediately by the pending interrupt request. 21.8.2 releasing sub-idle mode the sub-idle mode is released by a non-maskable inte rrupt request signal (nmi pin input, intwdt2 signal), unmasked external interrupt request signal (intp0 to intp 8 pin input), unmasked internal interrupt request signal from the peripheral functions operable in the sub-idle mode, or reset signal (reset by reset pin input, wdt2res signal, low-voltage detector (lvi), or clock monitor (clm)). the pll returns to the operat ing status it was in before the sub-idle mode was set. when the sub-idle mode is released by an interrupt request signal, the subclock operation mode is set. (1) releasing sub-idle m ode by non-maskable interrupt request signal or unmasked maskable interrupt request signal the sub-idle mode is released by a non-maskable interrupt request signal or an unmasked maskable interrupt request signal, regardless of the pr iority of the interrupt request signal. if the sub-idle mode is set in an inte rrupt servicing routine, however, an in terrupt request signal that is issued later is serviced as follows. (a) if an interrupt request signal with a priority lower than that of the interrupt requ est currently being serviced is issued, the sub-idle mode is released, but that interrupt request signal is not acknowledged. the interrupt request signal itself is retained. (b) if an interrupt request signal with a priority higher than that of the interrupt requ est currently being serviced is issued (including a non-maskable interrupt reques t signal), the sub-idle mode is released and that interrupt request signal is acknowledged. cautions 1. the interrupt request signal that is disabled by setting the psc.nmi1m, psc.nmi0m, and psc.intm bits to 1 becomes invalid and sub-idle mode is not released. 2. when the sub-idle mode is relea sed, 12 cycles of the subclock (about 366 s) elapse from when the interrupt request signal that releases the sub-idle mode is generated to when the mode is released.
chapter 21 standby function preliminary user's manual u17714ej1v0ud 708 table 21-11. operation after releasing sub- idle mode by interrupt request signal release source interrupt enabled (ei) status interrupt disabled (di) status non-maskable interrupt request signal execution branches to the handler address. maskable interrupt request signal execution branches to the handler address or the next instruction is executed. the next instruction is executed. (2) releasing sub-idle mode by reset the same operation as the normal reset operation is performed. table 21-12. operating status in sub-idle mode setting of sub-idle mode operating status item when main clock is oscillating when main clock is stopped subclock oscillator oscillation enabled internal oscillator oscillation enabled pll operable stops operation note 1 cpu stops operation dma stops operation interrupt controller stops operation (but standby mode release is possible) timer p (tmp0 to tmp8) stops operation timer q (tmq0) stops operation timer m (tmm0) operable when f r /8 or f xt is selected as the count clock watch timer stops operation operable when f xt is selected as the count clock watchdog timer 2 operable when f r or f xt is selected as the count clock csib0 to csib5 operable when the sckbn input cloc k is selected as the count clock (n = 0 to 5) i 2 c00 to i 2 c02 stops operation serial interface uarta0 to uarta3 stops operation (but uarta0 is operable when the ascka0 input clock is selected) a/d converter holds operation (conversion result held) note 2 d/a converter holds operation (output held note 2 ) real-time output function (rto) stops operation (output held) key interrupt function (kr) operable external bus interface see 2.2 pin states (same operation status as idle1, idle2 mode). port function retains status before sub-idle mode was set internal data the cpu registers, statuses, data, and all other internal data such as the contents of the internal ram are retained as they were before the sub-idle mode was set. notes 1. be sure to stop the pll (pllctl.pllon bi t = 0) before stopping the main clock. 2. to realize low power consumpti on, stop the a/d and d/a converters before shifting to the sub-idle mode.
preliminary user's manual u17714ej1v0ud 709 chapter 22 reset functions 22.1 overview the following reset functions are available. (1) four kinds of reset sources ? external reset input via the reset pin ? reset via the watchdog timer 2 (wdt2) overflow (wdt2res) ? system reset via the comparison of the low-volt age detector (lvi) supply voltage and detected voltage ? system reset via the detecting clock monitor (clm) oscillation stop after a reset is released, the source of the reset can be confirmed with the reset source flag register (resf). (2) emergency operation mode if the wdt2 overflows during the main clock oscillation stabilization time inserted after reset, a main clock oscillation anomaly is judged and the cpu starts operating on the internal oscillation clock. caution when the cpu is being operated with the inte rnal oscillation clock, access to the register in which a wait state is generated is prohibited. for the register in which a wait state is generated, see 3.4.8 (2) accessing speci fic on-chip peripheral i/o registers. figure 22-1. block di agram of reset function clmrf lvirf wdt2rf reset source flag register (resf) internal bus wdt2 reset signal clm reset signal reset lvi reset signal reset signal reset signal reset signal to lvim/lvis register clear set set clear clear set caution an lvi circuit internal r eset does not reset the lvi circuit. remarks 1. lvim: low-voltage detection register 2. lvis: low-voltage detection level selection register
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 710 22.2 registers to check reset source the v850es/jj2 has four kinds of reset sources. after a reset has been released, the source of the reset that occurred can be checked with the reset source flag register (resf). (1) reset source flag register (resf) the resf register is a special regist er that can be written only by a comb ination of specific sequences (see 3.4.7 special registers ). the resf register indicates the source from which a reset signal is generated. this register is read or written in 8-bit or 1-bit units. reset pin input clears this register to 00h. the defaul t value differs if the source of reset is other than the reset pin signal. 0 wdt2rf 0 1 not generated generated resf 0 0 wdt2rf 0 0 clmrf lvirf after reset: 00h note r/w address: fffff888h reset signal from wdt2 lvirf 0 1 not generated generated reset signal from lvi clmrf 0 1 not generated generated reset signal from clm note the value of the resf register is cleared to 00h when a reset is executed via the reset pin. when a reset is executed by the watchdog timer 2 (wdt2), lo w-voltage detector (lvi), or clock monitor (clm), the reset flags of this register (wdt2rf bit, clmrf bi t, and lvirf bit) are set. however, other sources are retained. caution only "0" can be written to ea ch bit of this register. if writin g "0" conflicts with setting the flag (occurrence of reset), setting the flag takes precedence.
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 711 22.3 operation 22.3.1 reset operation via reset pin when a low level is input to the reset pin, the syst em is reset, and each hardware unit is initialized. when the level of the reset pin is changed from low to high, the reset status is released. table 22-1. hardware status on reset pin input item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f x to f x /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f clk ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to fxx/8) cpu initialized program execution starts after securing oscillation stabilization time watchdog timer 2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu acce ss and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note 1 . i/o lines (ports/alternate-function pins) high impedance note 2 on-chip peripheral i/o registers initialized to sp ecified status, ocdm register is set (01h). other on-chip peripheral functions operation st ops operation can be started after securing oscillation stabilization time notes 1. the firmware of the v850es/jj2 uses a part of the internal ram after the internal system reset status has been released because it supports a boot swap function. therefore, the contents of some ram areas are not retained after power-on reset. for details, see 22.3.4 operation after reset release . 2. when the power is turned on, the following pins may output an undefined level temporarily, even during reset. ? p10/ano0 pin ? p11/ano1 pin ? p53/sib2/kr3/tiq00/toq00/rtp03/ddo pin caution the ocdm register is initialized by the reset pin input. therefore, note with caution that, if a high level is input to the p05/drst pin after a reset release before the ocdm.ocdm0 bit is cleared, the on-chip debug mode is entered. for details, see chapter 4 port functions.
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 712 figure 22-2. timing of reset operation by reset pin input counting of oscillation stabilization time initialized to f xx /8 operation oscillation stabilization timer overflows internal system reset signal analog delay (eliminated as noise) analog delay analog delay (eliminated as noise) reset f x f clk analog delay figure 22-3. timing of power-on reset operation oscillation stabilization time count must be on-chip regulator stabilization time (1 ms (max.)) or longer. initialized to f xx /8 operation overflow of timer for oscillation stabilization internal system reset signal reset f x v dd f clk analog delay
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 713 22.3.2 reset operation by watchdog timer 2 when watchdog timer 2 is set to the reset operation mode due to overflow, upon watchdog timer 2 overflow (wdt2res signal generati on), a system reset is executed and the hardware is initialized to the initial status. following watchdog timer 2 overflow, the reset status is entered and lasts the predetermined time (analog delay), and the reset status is then automatically released. the main clock oscillator is stopped during the reset period. table 22-2. hardware status during watchdog timer 2 reset operation item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f xx to f xx /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f xx ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to fxx/8) cpu initialized program execution after securing oscillation stabilization time watchdog timer 2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu ac cess and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note . i/o lines (ports/alternate-function pins) high impedance on-chip peripheral i/o register initialized to spec ified status, ocdm register retains its value. on-chip peripheral functions other than above operation stops operation can be started after securing oscillation stabilization time. note the firmware of the v850es/jj2 uses a part of the internal ram after the internal system reset status has been released because it supports a boot swap functi on. therefore, the content s of some ram areas are not retained after power-on reset. for details, see 22.3.4 operation after reset release .
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 714 figure 22-4. timing of reset oper ation by wdt2res signal generation counting of oscillation stabilization time initialized to f xx /8 operation oscillation stabilization timer overflow internal system reset signal wdt2res f x f clk analog delay
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 715 22.3.3 reset operation by low-voltage detector if the supply voltage falls below the vo ltage detected by the low-voltage dete ctor when lvi operation is enabled, a system reset is executed (when the lvim.lvimd bit is set to 1), and the hardware is initia lized to the initial status. the reset status lasts from when a supply voltage drop has been detected until the su pply voltage rises above the lvi detection voltage. the main clock oscillator is stopped during the reset period. when the lvimd bit = 0, an interrupt request signal (i ntlvi) is generated if a low voltage is detected. table 22-3. hardware status during reset operation by low-voltage detector item during reset after reset main clock oscillator (f x ) oscillation stops oscillation starts subclock oscillator (f xt ) oscillation continues internal oscillator oscillation stops oscillation starts peripheral clock (f x to f x /1,024) operation stops operation starts after securing oscillation stabilization time internal system clock (f xx ), cpu clock (f cpu ) operation stops operation starts after securing oscillation stabilization time (initialized to f xx /8) cpu initialized program execution starts after securing oscillation stabilization time wdt2 operation stops (initialized to 0) counts up from 0 with internal oscillation clock as source clock. internal ram undefined if power-on reset or cpu ac cess and reset input conflict (data is damaged). otherwise value imm ediately after reset input is retained note . i/o lines (ports/alternate-function pins) high impedance on-chip peripheral i/o register initialized to spec ified status, ocdm register retains its value. lvi operation continues on-chip peripheral functions other than above operation stops operation can be started after securing oscillation stabilization time. note the firmware of the v850es/jj2 uses a part of the internal ram after the internal system reset status has been released because it supports a boot swap functi on. therefore, the content s of some ram areas are not retained after power-on reset. for details, see 22.3.4 operation after reset release . remark for the reset timing of the low-voltage detector, see chapter 24 low-voltage detector (lvi) .
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 716 22.3.4 operation after reset release after the reset is released, the main clock starts oscillati on and oscillation stabilization time (osts register initial value: 2 16 /f x ) is secured, and the cpu st arts program execution. wdt2 immediately begins to operate after a reset has been released using the internal oscillation clock as a source clock. figure 22-5. operation after reset release main clock reset counting of oscillation stabilization time normal operation (f cpu = main clock) operation stops operation in progress operation stops operation in progress clock monitor internal oscillation clock v850es/jj2 wdt2 (1) emergent operation mode if an anomaly occurs in the main clock before oscillation stabilization time is secured, wdt2 overflows before executing the cpu program. at this time, the cpu star ts program execution by using the internal oscillation clock as the source clock. figure 22-6. operation after reset release main clock reset counting of oscillation stabilization time wdt overflows emergency mode (f cpu = internal oscillation clock) operation stops operation in progress operation in progress (re-count) operation stops clock monitor internal oscillation clock v850es/jj2 wdt2 the cpu operation clock states c an be checked with the cpu operation clock status register (ccls).
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 717 (2) firmware operation in the v850es/jj2, after the reset status is released, th e internal firmware starts operation before the user program is started to support the boot swap function. reset oscillation stabilization time user program operation start firmware operation firmware operation time: 14974 (1/f x ) (seconds) remark f x : main clock oscillation frequency (mhz) since the firmware uses a part of the internal ram, the contents of the following ram areas are not retained after power-on reset. ? version with 12 kb ram: 03ffefbah to 03ffefffh ? version with 24 kb ram: 03ffefbah to 03ffefffh ? version with 32 kb ram: 03ff7000h to 03ff7095h, 03ffefbah to 03ffefffh ? version with 40 kb ram: 03ffefbah to 03ffefffh ? version with 48 kb ram: 03ff3000h to 03ff3095h, 03ffefbah to 03ffefffh
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 718 (a) version with 12 kb ram (b) version with 24 kb ram ram retention disabled area (70 bytes) ram retention enabled area 12 kb ram retention disabled area (70 bytes) ram retention enabled area 24 kb 03ffefffh 03ffefbah 03ffefb9h 03ffc000h 03ffefffh 03ffefbah 03ffefb9h 03ff9000h (c) version with 32 kb ram (d) version with 40 kb ram ram retention disabled area (150 bytes) ram retention disabled area (70 bytes) ram retention enabled area 32 kb ram retention disabled area (70 bytes) ram retention enabled area 40 kb 03ffefffh 03ffefbah 03ffefb9h 03ff7096h 03ff7095h 03ff7000h 03ffefffh 03ffefbah 03ffefb9h 03ff5000h (e) version with 48 kb ram ram retention disabled area (150 bytes) ram retention disabled area (70 bytes) ram retention enabled area 48 kb 03ffefffh 03ffefbah 03ffefb9h 03ff3096h 03ff3095h 03ff3000h
chapter 22 reset functions preliminary user's manual u17714ej1v0ud 719 22.3.5 reset function operation flow start (reset source occurs) main clock oscillation stabilization time secured? no ccls.cclsf bit = 1? yes no (in normal operation mode) no (in emergent operation mode) reset source generated? yes no yes (in normal operation mode) wdt2 overflow? no yes (in emergent operation mode) set resf register note 1 reset occurs reset release emergent operation software processing normal operation cpu operation starts from reset address (f cpu = f x /8, f r ) firmware opration f cpu = f x f cpu = f r note 2 ccls.cclsf bit 1 wdt2 restart internal oscillation and main clock oscillation start, wdt2 count up starts (reset mode) notes 1. bit to be set differs depending on the reset source. reset source wdt2rf bit crmrf bit lvirf bit reset pin 0 0 0 wdt2 1 value before reset is retained. value before reset is retained. clm value before reset is retained. 1 value before reset is retained. lvi value before reset is retained. value before reset is retained. 1 2. the internal oscillator cannot be stopped.
preliminary user's manual u17714ej1v0ud 720 chapter 23 clock monitor 23.1 functions the clock monitor samples the main clock by using the internal oscillation clock and generates a reset request signal when oscillation of the main clock is stopped. once the operation of the clock monitor has been enabled by an operation enable flag, it cannot be cleared to 0 by any means other than reset. when a reset by the clock monitor occurs, the resf.clmrf bit is set. for details on the resf register, see 22.2 registers to check reset source . the clock monitor automatically stops under the following conditions. ? during oscillation stabilization time after stop mode is released ? when the main clock is stopped (from when the pcc.mck bit = 1 during subclock operation, until the pcc.cls bit = 0 during main clock operation) ? when the sampling clock (internal oscillation clock) is stopped ? when the cpu operates with the internal oscillation clock 23.2 configuration the clock monitor includes the following hardware. table 23-1. configuration of clock monitor item configuration control register clock monitor mode register (clm) figure 23-1. timing of reset via the reset pin input main clock internal oscillation clock internal reset signal enable/disable clme clock monitor mode register (clm)
chapter 23 clock monitor preliminary user's manual u17714ej1v0ud 721 23.3 register the clock monitor is controlled by the clock monitor mode register (clm). (1) clock monitor mode register (clm) the clm register is a special regist er. this can be written only in a s pecial combination of sequences (see 3.4.7 special registers ). this register is used to set the operation mode of the clock monitor. this register can be read or written in 8-bit or 1-bit units. reset sets this register to 00h. after reset: 00h r/w address: fffff870h 7 6 5 4 3 2 1 <0> clm 0 0 0 0 0 0 0 clme clme clock monitor operation enable or disable 0 disable clock monitor operation. 1 enable clock monitor operation. cautions 1. once the clme bit h as been set to 1, it cannot be cleared to 0 by any means other than reset. 2. when a reset by the clock monitor occu rs, the clme bit is cleared to 0 and the resf.clmrf bit is set to 1.
chapter 23 clock monitor preliminary user's manual u17714ej1v0ud 722 23.4 operation this section explains the functions of the clock m onitor. the start and stop conditions are as follows. enabling operation by setting the clm.clme bit to 1 ? while oscillation stabilization time is being counted after stop mode is released ? when the main clock is stopped (from when pcc.mck bit = 1 during subclock operation to when pcc.cls bit = 0 during main clock operation) ? when the sampling clock (internal oscillation clock) is stopped ? when the cpu operates using the internal oscillation clock table 23-2. operation status of clock monitor (when clm.clme bit = 1, during inte rnal oscillation clock operation) cpu operating clock operation mode status of main clock status of internal oscillation clock status of clock monitor halt mode oscillates oscillates note 1 operates note 2 idle1, idle2 modes oscillates oscillates note 1 operates note 2 main clock stop mode stops oscillates note 1 stops subclock (mck bit of pcc register = 0) sub-idle mode oscillates oscillates note 1 operates note 2 subclock (mck bit of pcc register = 1) sub-idle mode stops oscillates note 1 stops internal oscillation clock ? stops oscillates note 3 stops during reset ? stops stops stops notes 1. the internal oscillator can be stopped by setting the rcm.rstop bit to 1. 2. the clock monitor is stopped while t he internal oscillator is stopped. 3. the internal oscillator cannot be stopped by software.
chapter 23 clock monitor preliminary user's manual u17714ej1v0ud 723 (1) operation when main clock osc illation is stopped (clme bit = 1) if oscillation of the main clock is stopped when the clme bit = 1, an internal reset signal is generated as shown in figure 23-2. figure 23-2. reset period due to that oscillation of main clock is stopped four internal oscillation clocks main clock internal oscillation clock internal reset signal clm.clme bit resf.clmrf bit (2) clock monitor status after reset input reset input clears the clm.clme bit to 0 and stops the cl ock monitor operation. when clme bit is set to 1 by software at the end of the oscillation stabilization time of the main clock, monitoring is started. figure 23-3. clock monitor status after reset input (clm.clme bit = 1 is set after reset input and at the end of main clock oscillation stabilization time) cpu operation clock monitor status clme reset internal oscillation clock main clock reset oscillation stabilization time normal operation clock supply stopped normal operation monitoring monitoring stopped monitoring set to 1 by software
chapter 23 clock monitor preliminary user's manual u17714ej1v0ud 724 (3) operation in stop mode or after stop mode is released if the stop mode is set with the clm.clme bit = 1, t he monitor operation is st opped in the stop mode and while the oscillation stabilization ti me is being counted. after the osc illation stabilization time, the monitor operation is automatically started. figure 23-4. operation in stop mode or after stop mode is released clock monitor status during monitor monitor stops during monitor clme internal oscillation clock main clock cpu operation normal operation stop oscillation stabilization time normal operation oscillation stops oscillation stabilization time (set by osts register) (4) operation when main clock is stopped (arbitrary) during subclock operation (pcc.cls bit = 1) or when the main clock is stopped by setting the pcc.mck bit to 1, the monitor operation is stopped until the main cloc k operation is started (pcc.cls bit = 0). the monitor operation is automatically started when the main clock operation is started. figure 23-5. operation when main clock is stopped (arbitrary) clock monitor status during monitor monitor stops monitor stops during monitor clme internal oscillation clock main clock cpu operation oscillation stops subclock operation main clock operation oscillation stabilization time (set by osts register) oscillation stabilization time count by software pcc.mck bit = 1 (5) operation while cpu is operating on inte rnal oscillation clock (ccls.cclsf bit = 1) the monitor operation is not stopped when the cclsf bi t is 1, even if the clme bit is set to 1.
preliminary user's manual u17714ej1v0ud 725 chapter 24 low-voltage detector (lvi) 24.1 functions the low-voltage detector (lvi) has the following functions. ? compares the supply voltage (v dd ) and detected voltage (v lv i ) and generates an internal interrupt signal or internal reset signal when v dd < v lv i . ? the level of the supply voltage to be detecte d can be changed by software (in two steps). ? interrupt or reset signal c an be selected by software. ? can operate in stop mode. if the low-voltage detector is used to generate a reset signal, the resf.lvirf bit is set to 1 when the reset signal is generated. for details of resf register, see 22.2 registers to check reset source . 24.2 configuration the block diagram of the low-vo ltage detector is shown below. figure 24-1. block diagram of low-voltage detector lvis0 lvion detected voltage source (v lvi ) v dd v dd intlvi internal bus n-ch low-voltage detection level select register (lvis) low-voltage detection register (lvim) lvimd lvif internal reset signal selector low- voltage detection level selector ? +
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 726 24.3 registers the low-voltage detector is contro lled by the following registers. ? low-voltage detection register (lvim) ? low-voltage detection level select register (lvis) (1) low-voltage detection register (lvim) the lvim register is a special register. this can be written only in the special combination of the sequences (see 3.4.7 special registers ). the lvim register is used to enable or disable low-vo ltage detection, and to set the operation mode of the low- voltage detector. this register can be read or written in 8-bit or 1- bit units. however, the lvif bit is read-only. after reset: note 1 r/w address: fffff890h <7> 6 5 4 3 2 <1> <0> lvim lvion 0 0 0 0 0 lvimd lvif lvion low-voltage detection operation enable or disable 0 disable operation. 1 enable operation. lvimd selection of operation mode of low-voltage detection 0 generate interrupt request signal intlvi when supply voltage < detected voltage. 1 generate internal reset signal lvires when supply voltage < detected voltage. lv i f note 2 low-voltage detection flag 0 when supply voltage > detected voltage, or when operation is disabled 1 supply voltage of connected power supply < detected voltage notes 1. reset by low-voltage detection: 82h reset due to other source: 00h 2. the value of the lvif flag is output as th e interrupt request signal intlvi when the lvion bit = 1 and lvimd bit = 0. cautions 1. when the lvion and lvimd bits to 1, the low-voltage detector cannot be stopped until the reset request due to other than th e low-voltage detection is generated. 2. when the lvion bit is set to 1, the comparator in the lvi circuit starts operating. wait 0.2 ms or longer by software before checking the voltage at the lvif bit after the lvion bit is set. 3. be sure to clear bits 6 to 2 to ?0?.
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 727 (2) low-voltage detection level select register (lvis) the lvis register is used to select t he level of low voltage to be detected. this register can be read or written in 8-bit or 1-bit units. after reset: note r/w address: fffff891h 7 6 5 4 3 2 1 0 lvis 0 0 0 0 0 0 0 lvis0 lvis0 detection level 0 3.0 v 0.15 v 1 2.85 v 0.15 v (setting prohibited) note reset by low-voltage detection: retained reset due to other source: 00h cautions 1. this register cannot be written until a reset request due to something other than low-voltage detection is generated after the lvim.lvion and lvim.lvimd bits are set to 1. 2. be sure to clear bits 7 to 1 to ?0?. (3) internal ram data status register (rams) the rams register is a special register. this can be written only in a special combination of sequences (see 3.4.7 special registers ). this register is a flag register that indica tes whether the internal ram is valid or not. this register can be read or written in 8-bit or 1-bit units. the set/clear conditions for the ramf bit are shown below. ? setting conditions: detection of voltage lower than specified level set by instruction generation of reset signal by wdt2 and clm generation of reset signal while ram is being accessed generation of reset signal via the reset pin while internal ram is being accessed. ? clearing condition: writing of 0 in specific sequence after reset: 01h note r/w address: fffff892h 7 6 5 4 3 2 1 <0> rams 0 0 0 0 0 0 0 ramf ramf internal ram data valid/invalid 0 valid 1 invalid note this register is set to 01h after reset by t he reset pin input (only for ram access), watchdog timer 2 overflow, or clock monitor. after reset by other sources, the register value at that time is retained.
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 728 24.4 operation depending on the setting of the lvim.vimd bit, an interrupt si gnal (intlvi) or an internal reset signal is generated. how to specify each operation is described below, together with timing charts. 24.4.1 to use for inte rnal reset signal <1> mask the interrupt of lvi. <2> select the voltage to be detected by using the lvis.lvis0 bit. <3> set the lvim.lvion bit to 1 (to enable operation). <4> insert a wait cycle of 0.2 ms (max.) or more by software. <5> by using the lvim.lvif bit, check if the supply voltage > detected voltage. <6> set the lvimd bit to 1 (to generate an internal reset signal). caution if the lvimd bit is set to 1, the contents of the lvim and lvis registers cannot be changed until a reset request other than lvi is generated. figure 24-2. operation timing of low-voltage detector (lvimd bit = 1) supply voltage (v dd ) lvi detected voltage (3.0 0.15 v) lvion bit lvi detected signal internal reset signal (active low) lvi reset request signal delay clear delay time
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 729 24.4.2 to use for interrupt <1> mask the interrupt of lvi. <2> select the voltage to be detected by using the lvis.lvis0 bit. <3> set the lvim.lvion bit to 1 (to enable operation). <4> insert a wait cycle of 0.2 ms (max.) or more by software. <5> by using the lvim.lvif bit, check if the supply voltage > detected voltage. <6> clear the interrupt request flag of lvi. <7> unmask the interrupt of lvi. clear the lvion bit to 0. figure 24-3. operation timing of low- voltage detector (lvimd bit = 0) external resetic detected voltage reset pin intlvi signal supply voltage (v dd ) lvi detected voltage (3.0 0.15 v) lvion bit lvi detected signal internal reset signal (active low) delay clear delay time delay
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 730 24.5 ram retention voltage detection operation the supply voltage and detected voltage are compared. w hen the supply voltage drops below the detected voltage (including on power application), the rams.ramf bit is set to 1. figure 24-4. operation timing of ram retention voltage detection function supply voltage (v dd ) 2.0 v (minimum ram retention voltage) reset pin rams.ramf bit initialize ram (ramf bit is also cleared) when power application, ramf bit is set ram data is retained ram data is retained ramf bit = 0 is retained regardless of reset pin if v dd > 2.0 v initialize ram (ramf bit is also cleared) v dd < 2.0 v detected set ramf bit ram data is not retained remarks 1. the ramf bit is set to 1 if the supply volt age drops under the minimum ram retention voltage (2.0 v (typ.)). 2. the ramf bit operates regardl ess of the reset pin status.
chapter 24 low-voltage detector (lvi) preliminary user's manual u17714ej1v0ud 731 24.6 emulation function when an in-circuit emulator is used, the operation of the ram retention flag (rams.ramf bit) can be pseudo- controlled and emulated by manipulating the pemu1 register on the debugger. this register is valid only in the emulation mode. it is invalid in the normal mode. (1) peripheral emulation register 1 (pemu1) after reset: 00h r/w address: fffff9feh 7 6 5 4 3 2 1 0 pemu1 0 0 0 0 0 evaramin 0 0 evaramin pseudo specification of ram retention voltage detection signal 0 do not detect voltage lower than ram retention voltage. 1 detect voltage lower than ram retention voltage (set ramf flag). caution this bit is not automatically cleared. [usage] when an in-circuit emulator is used, pseudo emulation of ramf is realized by rewriting this register on the debugger. <1> cpu break (cpu operation stops.) <2> set the evaramin bit to 1 by using a register write command. by setting the evaramin bit to 1, the ramf bit is se t to 1 on hardware (the internal ram data is invalid). <3> clear the evaramin bit to 0 by using a register write command again. unless this operation is performed (clearing the evaram in bit to 0), the ramf bit cannot be cleared to 0 by a cpu operation instruction. <4> run the cpu and resume emulation.
preliminary user's manual u17714ej1v0ud 732 chapter 25 regulator 25.1 overview the v850es/jj2 includes a regulator to reduce power consumption and noise. this regulator supplies a stepped-down v dd power supply voltage to the oscillator block and internal logic circuits (except the a/d converter, d/a converte r, and output buffers). the regulator output voltage is set to 2.5 v (typ.). figure 25-1. regulator bv dd av ref0 av ref1 flmd0 v dd ev dd regc ev dd i/o buffer bidirectional level shifter bv dd i/o buffer regulator a/d converter d/a converter flash memory main oscillator internal digital circuits 2.5 v (typ.) sub-oscillator caution use the regulator with a setting of v dd = ev dd = av ref0 = av ref1 bv dd .
chapter 25 regulator preliminary user's manual u17714ej1v0ud 733 25.2 operation the regulator of this product always operates in any mode (normal oper ation mode, halt mode, idle1 mode, idle2 mode, stop mode, or during reset). be sure to connect a capacitor (4.7 f (preliminary value)) to the regc pin to stabilize the regulator output. a diagram of the regulator pin connection method is shown below. figure 25-2. regc pin connection reg v dd v ss regc input voltage = 2.85 to 3.6 v voltage supply to main oscillator/internal logic = 2.5 v (typ.) 4.7 f (preliminary value) voltage supply to sub-oscillator
preliminary user's manual u17714ej1v0ud 734 chapter 26 flash memory the v850es/jj2 incorporates a flash memory. ? pd70f3720: 128 kb flash memory ? pd70f3721: 256 kb flash memory ? pd70f3722: 384 kb flash memory ? pd70f3723: 512 kb flash memory ? pd70f3724: 640 kb flash memory flash memory versions offer the following advantages for development environments and mass production applications. for altering software after the v850es/ jj2 is soldered onto the target system. for data adjustment when starting mass production. for differentiating software according to the specif ication in small scale production of various models. for facilitating inventory management. for updating software after shipment. 26.1 features 4-byte/1-clock access (when instruction is fetched) capacity: 640/512/384/256/128 kb write voltage: erase/write with a single power supply rewriting method ? rewriting by communication with dedicated flash programmer via serial interface (on-board/off-board programming) ? rewriting flash memory by user program (self programming) flash memory write prohibit f unction supported (security function) safe rewriting of entire flash memory area by self programming using boot swap function interrupts can be acknowledged during self programming.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 735 26.2 memory configuration the v850es/jj2 internal flash memory area is divided into 16, 14, 12, 10, or 8 blocks and can be programmed/erased in block units. all of the blocks can also be erased at once. when the boot swap function is used, the physical memory allocated at the addresses of blocks 0 and 1 is replaced by the physical memory allocated at the addresses of bloc ks 2 and 3. for details of the boot swap function, see 26.5 rewriting by self programming . figure 26-1. flash memory mapping 640 kb block 0 (28 kb) block 1 (28 kb) block 2 (28 kb) block 3 (28 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 8 (64 kb) block 4 (4 kb) block 9 (64 kb) block 10 (64 kb) block 11 (64 kb) block 12 (64 kb) block 13 (64 kb) 512 kb block 0 (28 kb) block 1 (28 kb) block 2 (28 kb) block 3 (28 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 8 (64 kb) block 4 (4 kb) block 9 (64 kb) block 10 (64 kb) block 11 (64 kb) block 12 (64 kb) block 13 (64 kb) block 15 (64 kb) block 14 (64 kb) note 2 384 kb block 0 (28 kb) block 1 (28 kb) block 2 (28 kb) block 3 (28 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 8 (64 kb) block 4 (4 kb) block 9 (64 kb) block 10 (64 kb) block 11 (64 kb) 256 kb block 0 (28 kb) block 1 (28 kb) block 2 (28 kb) block 3 (28 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 8 (64 kb) block 4 (4 kb) block 9 (64 kb) 128 kb block 0 (28 kb) block 1 (28 kb) block 2 (28 kb) block 3 (28 kb) block 5 (4 kb) block 6 (4 kb) block 7 (4 kb) block 4 (4 kb) note 1 00000000h 00006fffh 00007000h 0000dfffh 0000e000h 00014fffh 00015000h 0001bfffh 0001c000h 0001cfffh 0001d000h 0001dfffh 0001e000h 0001efffh 0001f000h 0001ffffh 00020000h 0002ffffh 00030000h 0003ffffh 00040000h 0004ffffh 00050000h 0005ffffh 00060000h 0006ffffh 00070000h 0007ffffh 00080000h 0008ffffh 00090000h 0009ffffh 000a0000h notes 1. blocks 2 and 3: area to be replaced with the boot area by the boot swap function 2. blocks 0 and 1: boot area
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 736 26.3 functional outline the internal flash memory of the v850es/jj2 can be rewrit ten by using the rewrite func tion of the dedicated flash programmer, regardless of whether the v850es/jj2 has already been mounted on the target system or not (off- board/on-board programming). in addition, a security function that prohi bits rewriting the user program written to the internal flash memory is also supported, so that the program c annot be changed by an unauthorized person. the rewrite function using the user program (self programmi ng) is ideal for an application where it is assumed that the program is changed after production/sh ipment of the target syst em. a boot swap function t hat rewrites the entire flash memory area safely is also supported. in addition, interrupt servicing is supported during self programming, so that the flash memory can be rewritten und er various conditions, such as while communicating with an external device. table 26-1. rewrite method rewrite method functional outline operation mode on-board programming flash memory can be rewritten after the device is mounted on the target system, by using a dedicated flash programmer. off-board programming flash memory can be rewritten before the device is mounted on the target system, by using a dedicated flash programmer and a dedicated program adapter board (fa series). flash memory programming mode self programming flash memory can be rewritten by executing a user program that has been written to the flash memory in advance by means of off-board/on- board programming. (during self-programming, instructions cannot be fetched from or data access cannot be made to the internal flash memory area. therefore, the rewrite program must be transferred to the internal ram or external memory in advance.) normal operation mode remark the fa series is a product of na ito densei machida mfg. co., ltd.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 737 table 26-2. basic functions support ( : supported, : not supported) function functional outline on-board/off-board programming self programming block erasure the contents of specified memory blocks are erased. chip erasure the contents of the entire memory area are erased all at once. write writing to specified addresses, and a verify check to see if write level is secured are performed. verify/checksum data read from the flash memory is compared with data transferred from the flash programmer. (can be read by user program) blank check the erasure status of the entire memory is checked. security setting use of the block erase command, chip erase command, and program command can be prohibited. (only values set by on- board/off-board programming can be retained) the following table lists the security functions. the bl ock erase command prohibit, chip erase command prohibit, and program command prohibit functions are enabled by default after shipment, and security can be set by rewriting via on-board/off-board programming. each security function can be used in combination with the others at the same time. table 26-3. security functions rewriting operation when prohibited ( : executable, : not executable) function function outline on-board/off-board programming self programming block erase command prohibit execution of a block erase command on all blocks is prohibited. setting of prohibition can be initialized by execution of a chip erase command. block erase command: chip erase command: program command: chip erase command prohibit execution of block erase and chip erase commands on all the blocks is prohibited. once prohibition is set, setting of prohibition cannot be initialized because the chip erase command cannot be executed. block erase command: chip erase command: program command: program command prohibit write and block erase commands on all the blocks are prohibited. setting of prohibition can be initialized by execution of the chip erase command. block erase command: chip erase command: program command: can always be rewritten regardless of setting of prohibition
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 738 26.4 rewriting by dedicated flash programmer the flash memory can be rewritten by using a dedicated flash programmer after the v850es/jj2 is mounted on the target system (on-board programming). the flash memory can also be rewritten before the device is mounted on the target system (off-board programming) by using a dedicated program adapter (fa series). 26.4.1 programming environment the following shows the environment required for writi ng programs to the flash memory of the v850es/jj2. figure 26-2. environment required for writing programs to flash memory host machine rs-232c dedicated flash programmer v850es/jj2 flmd1 note v dd v ss reset uarta0/csib0/csib3 pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 usb note connect the flmd1 pin to the flash programmer or con nect to a gnd via a pull-down resistor on the board. a host machine is required for controlling the dedicated flash programmer. uarta0, csib0, or csib3 is used for the interface between the dedicated flash programmer and the v850es/jj2 to perform writing, erasing, etc. a dedicated program adapter (fa series) required for off-board writing. remark the fa series is a product of naito densei machida mfg. co., ltd.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 739 26.4.2 communication mode communication between the dedicated flash progra mmer and the v850es/jj2 is performed by serial communication using the uarta0, csib0, or csib3 interfaces of the v850es/jj2. (1) uarta0 transfer rate: 9,600 to 153,600 bps figure 26-3. communication with dedicated flash programmer (uarta0) dedicated flash programmer v850es/jj2 v dd v ss reset txda0 rxda0 flmd1 flmd1 note v dd gnd reset rxd txd pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 flmd0 note connect the flmd1 pin to the flash programmer or con nect to gnd via a pull-down resistor on the board. (2) csib0, csib3 serial clock: 2.4 khz to 2.5 mhz (msb first) figure 26-4. communication with dedica ted flash programmer (csib0, csib3) dedicated flash programmer v850es/jj2 flmd1 note v dd v ss reset sob0, sob3 sib0, sib3 sckb0, sckb3 flmd1 v dd gnd reset si so sck pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx x xx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 flmd0 note connect the flmd1 pin to the flash programmer or con nect to gnd via a pull-down resistor on the board.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 740 (3) csib0 + hs, csib3 + hs serial clock: 2.4 khz to 2.5 mhz (msb first) figure 26-5. communication with dedicated flash programmer (csib0 + hs, csib3 + hs) dedicated flash programmer v850es/jj2 v dd v ss reset sob0, sob3 sib0, sib3 sckb0, sckb3 pcm0 v dd flmd1 flmd1 note gnd reset si so sck hs pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve flmd0 flmd0 note connect the flmd1 pin to the flash programmer or con nect to a gnd via a pull-down resistor on the board. the dedicated flash programmer outputs the transfer clock, and the v850es/jj2 operates as a slave. when the pg-fp4 is used as the dedicated flash programmer , it generates the following signals to the v850es/jj2. for details, refer to the pg-fp4 user's manual (u15260e) . table 26-4. signal connections of dedicated flash programmer (pg-fp4) pg-fp4 v850es/jj2 pr ocessing for connection signal name i/o pin function pin name uarta0 csib0, csib3 csib0 + hs, csib3 + hs flmd0 output write enable/disable flmd0 flmd1 output write enable/disable flmd1 note 1 note 1 note 1 vdd ? v dd voltage generation/voltage monitor v dd gnd ? ground v ss clk output clock output to v850es/jj2 x1, x2 note 2 note 2 note 2 reset output reset signal reset si/rxd input receive signal sob0, sob3/ txda0 so/txd output transmit signal sib0, sib3/ rxda0 sck output transfer clock sckb0, sckb3 hs input handshake signal for csib0 + hs, csib3 + hs communication pcm0 notes 1. wire these pins as shown in figure 26-6, or connect then to gnd via pull-down resistor on board. 2. clock cannot be supplied via the clk pin of the flash programmer. create an oscillator on board and supply the clock. remark : must be connected. : does not have to be connected.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 741 table 26-5. wiring of flash writing ad apter for v850es/jj2 (fa-144gj-uen) (1/2) flash programmer (pg-fp4) connection pins when csib0 + hs is used when csib0 is used when uarta0 is used signal name i/o pin function pin name on fa board pin name pin no. pin name pin no. pin name pin no. si/rxd input receive signal si p41/sob0/scl01 23 p41/sob0/scl01 23 p30/txda0/sob4 25 so/txd output transmit signal so p40/sib0 /sda01 22 p40/sib0/sda01 22 p31/rxda0/intp7/ sib4 26 sck output transfer clock sck p42/sckb0 24 p42/sckb0 24 not necessary ? x1 not necessary ? not necessary ? not necessary ? clk output clock to v850es/jj2 x2 not necessary ? not necessary ? not necessary ? /reset output reset signal /reset reset 14 reset 14 reset 14 flmd0 input write voltage flmd0 flmd0 8 flmd0 8 flmd0 8 flmd1 input write voltage flmd1 pdl5/ad5/flmd1 110 pdl5/ad5/flmd1 110 pdl5/ad5/flmd1 110 hs input handshake signal of csi0 + hs communication reserve / hs pcm0/wait 85 not necessary ? not necessary ? v dd 9 v dd 9 v dd 9 bv dd 104 bv dd 104 bv dd 104 ev dd 34 ev dd 34 ev dd 34 av ref0 1 av ref0 1 av ref0 1 vdd ? vdd voltage generation/ voltage monitor vdd av ref1 5 av ref1 5 av ref1 5 v ss 11 v ss 11 v ss 11 av ss 2 av ss 2 av ss 2 bv ss 103 bv ss 103 bv ss 103 gnd ? ground gnd ev ss 33 ev ss 33 ev ss 33 cautions 1. be sure to conn ect the regc pin to gnd via a 4.7 f capacitor. 2. a clock cannot be supplied from the clk pin of the flash programmer. create an oscillator on the board and supply the clock from that oscillator.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 742 table 26-5. wiring of flash writing ad apter for v850es/jj2 (fa-144gj-uen) (2/2) flash programmer (pg-fp4) connection pins when csib3 + hs is used when csib3 is used signal name i/o pin function pin name on fa board pin name pin no. pin name pin no. si/rxd input receive signal si p911/a11/sob3 72 p911/a11/sob3 72 so/txd output transmit signal so p910/a10/sib3 71 p910/a10/sib3 71 sck output transfer clock sck p912/a12/sckb3 73 p912/a12/sckb3 73 x1 not necessary ? not necessary ? clk output clock to v850es/jj2 x2 not necessary ? not necessary ? /reset output reset signal /reset reset 14 reset 14 flmd0 input write voltage flmd0 flmd0 8 flmd0 8 flmd1 input write voltage flmd1 pdl5/ad5/flmd1 110 pdl5/ad5/flmd1 110 hs input handshake signal of csi0 + hs communication reserve/hs pcm0/wait 85 not necessary ? v dd 9 v dd 9 bv dd 104 bv dd 104 ev dd 34 ev dd 34 av ref0 1 av ref0 1 vdd ? vdd voltage generation/ voltage monitor vdd av ref1 5 av ref1 5 v ss 11 v ss 11 av ss 2 av ss 2 bv ss 103 bv ss 103 gnd ? ground gnd ev ss 33 ev ss 33 cautions 1. be sure to conn ect the regc pin to gnd via a 4.7 f capacitor. 2. a clock cannot be supplied from the clk pin of the flash programmer. create an oscillator on the board and supply the clock from that oscillator.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 743 figure 26-6. example of wi ring of v850es/jj2 flash writing adapter (fa-144gj-uen) (in csib0 + hs mode) (1/2) v850es/jj2 vdd gnd gnd vdd gnd vdd vdd gnd 25 30 20 15 75 80 85 90 95 100 105 35 40 45 50 55 60 65 70 110 115 120 125 130 135 140 1 5 10 rfu-3 rfu-2 vde flmd1 flmd0 rfu-1 si so sck /reset v pp reserve/hs clkout note 4 note 1 note 2 2 note 3 connect to vdd connect to gnd 4.7 f (preliminary value)
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 744 figure 26-6. example of wi ring of v850es/jj2 flash writing adapter (fa-144gj-uen) (in csib0 + hs mode) (2/2) notes 1. wire the flmd1 pin as shown below, or connect it to gnd on board via a pull-down resistor. 2. pins used when csib3 is used 3. supply a clock by creating an oscillator on the fl ash writing adapter (enclos ed by the broken lines). here is an example of the oscillator. example x1 x2 4. pins used when uarta0 is used. caution do not input a high level to the drst pin. remarks 1. process the pins not shown in accord ance with processing of unused pins (see 2.3 pin i/o circuit types, i/o buffer power supplies and handling of unused pins ). 2. this adapter is for the 144-pin plastic lqfp package.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 745 26.4.3 flash memory control the following shows the procedure for manipulating the flash memory. figure 26-7. procedure for manipulating flash memory start select communication system manipulate flash memory end? yes supplies flmd0 pulse no end switch to flash memory programming mode
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 746 26.4.4 selection of communication mode in the v850es/jj2, the communication mode is selected by inputting pulses (12 pulses max.) to the flmd0 pin after switching to the flash memory programming mode. the flmd0 pulse is generated by the dedicated flash programmer. the following shows the relationship between the number of pulses and the communication mode. figure 26-8. selection of communication mode v dd v dd reset (input) flmd1 (input) flmd0 (input) rxda0 (input) txda0 (output) v ss v dd v ss v dd v ss v dd v ss v dd v ss v dd v ss (note) power on oscillation stabilized communication mode selected flash control command communication (erasure, write, etc.) reset released note the number of clocks is as follows depending on the communication mode. flmd0 pulse communication mode remarks 0 uarta0 communication rate: 9,600 bps (after reset), lsb first 8 csib0 v850es/jj2 performs slave operation, msb first 9 csib3 v850es/jj2 performs slave operation, msb first 11 csib0 + hs v850es/jj2 performs slave operation, msb first 12 csib3 + hs v850es/jj2 performs slave operation, msb first other rfu setting prohibited caution when uarta0 is selected , the receive clock is calculate d based on the reset command sent from the dedicated flash programme r after receiving the flmd0 pulse.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 747 26.4.5 communication commands the v850es/jj2 communicates with the dedicated flash programmer by means of commands. the signals sent from the dedicated flash programmer to the v850es/jj2 are called "commands". the response signals sent from the v850es/jj2 to the dedicated flash progra mmer are called "response commands". figure 26-9. communication commands dedicated flash programmer v850es/jj2 command response command pg-fp4 (flash pro4) cxxxxxx bxxxxx axxxx xxx yyy x x x x x x x x x x x x x x x xxxx yyyy statve the following shows the commands for flash memory cont rol in the v850es/jj2. all of these commands are issued from the dedicated flash programmer, and the v 850es/jj2 performs the processing corresponding to the commands. table 26-6. flash memory control commands support classification command name csib0, csib3 csib0 + hs, csib3 + hs uarta0 function blank check block blank check command checks if the contents of the memory in the specified block have been correctly erased. chip erase command erases the contents of the entire memory. erase block erase command erases the contents of the memory of the specified block. write write command writes the specified address range, and executes a contents verify check. verify command compares the contents of memory in the specified address range with data transferred from the flash programmer. verify checksum command reads the checksum in the specified address range. silicon signature command reads silicon signature information. system setting, control security setting command disables the chip erase command, block erase command, and write command.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 748 26.4.6 pin connection when performing on-board writing, mount a connector on t he target system to conne ct to the dedicated flash programmer. also, incorporate a function on-board to s witch from the normal operation mode to the flash memory programming mode. in the flash memory programming mode, all the pins not used for flash memory programming become the same status as that immediately after rese t. therefore, pin handling is required when the external device does not acknowledge the status immediately after a reset. (1) flmd0 pin in the normal operation mode, input a voltage of v ss level to the flmd0 pin. in the flash memory programming mode, supply a write voltage of v dd level to the flmd0 pin. because the flmd0 pin serves as a write protection pin in the self programming mode, a voltage of v dd level must be supplied to the flmd0 pin via port control, etc., before writing to the flash memory. for details, see 26.5.5 (1) flmd0 pin . figure 26-10. flmd0 pin connection example v850es/jj2 flmd0 dedicated flash programmer connection pin pull-down resistor (r flmd0 ) (2) flmd1 pin when 0 v is input to the flmd0 pin, t he flmd1 pin does not function. when v dd is supplied to the flmd0 pin, the flash memory programming mode is entered, so 0 v must be input to the flmd1 pin. the following shows an example of the connection of the flmd1 pin. figure 26-11. flmd1 pin connection example flmd1 pull-down resistor (r flmd1 ) other device v850es/jj2 caution if the v dd signal is input to the flmd1 pin from another device during on-board writing and immediately after reset, isolate this signal.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 749 table 26-7. relationship between flmd0 and flmd1 pi ns and operation mode wh en reset is released flmd0 flmd1 operation mode 0 don't care normal operation mode v dd 0 flash memory programming mode v dd v dd setting prohibited (3) serial interface pin the following shows the pins used by each serial interface. table 26-8. pins used by serial interfaces serial interface pins used uarta0 txda0, rxda0 csib0 sob0, sib0, sckb0 csib3 sob3, sib3, sckb3 csib0 + hs sob0, sib0, sckb0, pcm0 csib3 + hs sob3, sib3, sckb3, pcm0 when connecting a dedicated flash programmer to a serial interface pin that is connected to another device on-board, care should be taken to avoid conflict of signals and malfunction of the other device. (a) conflict of signals when the dedicated flash programmer (output) is connec ted to a serial interface pin (input) that is connected to another device (output), a conflict of signals occurs. to avoid the conflict of signals, isolate the connection to the other device or set the other device to the output high-impedance status. figure 26-12. conflict of signals (serial interface input pin) v850es/jj2 input pin conflict of signals dedicated flash programmer connection pins other device output pin in the flash memory programming mode, the signal that the dedicated flash programmer sends out conflicts with signals another device outputs. therefore, isolate the signals on the other device side.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 750 (b) malfunction of other device when the dedicated flash programmer (output or input) is connected to a serial interface pin (input or output) that is connected to another device (input), the signal is output to the other device, causing the device to malfunction. to avoid this, isolate the connection to the other device. figure 26-13. malfunction of other device v850es/jj2 pin dedicated flash programmer connection pin other device input pin in the flash memory programming mode, if the signal the v850es/jj2 outputs affects the other device, isolate the signal on the other device side. v850es/jj2 pin dedicated flash programmer connection pin other device input pin in the flash memory programming mode, if the signal the dedicated flash programmer outputs affects the other device, isolate the signal on the other device side.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 751 (4) reset pin when the reset signals of the dedicated flash programmer are connected to the reset pin that is connected to the reset signal generator on-board, a conflict of signal s occurs. to avoid the conflict of signals, isolate the connection to the reset signal generator. when a reset signal is input from the user system in the flash memory programming mode, the programming operation will not be performed correctly. therefore, do not input signals other than the reset signals from the dedicated flash programmer. figure 26-14. conflict of signals (reset pin) v850es/jj2 reset dedicated flash programmer connection pin reset signal generator conflict of signals output pin in the flash memory programming mode, the signal the reset signal generator outputs conflicts with the signal the dedicated flash programmer outputs. therefore, isolate the signals on the reset signal generator side. (5) port pins (including nmi) when the system shifts to the flash memory programmi ng mode, all the pins that are not used for flash memory programming are in the same st atus as that immediately after rese t. if the external device connected to each port does not recognize the st atus of the port immediately after reset, pins require appropriate processing, such as connecting to v dd via a resistor or connecting to v ss via a resistor. (6) other signal pins connect x1, x2, xt1, xt2, and regc in the same status as that in t he normal operation mode. during flash memory programming, input a low level to the drst pin or leave it open. do not input a high level. (7) power supply supply the same power (v dd , v ss , ev dd , ev ss , bv dd , bv ss , av ref0 , av ref1 , av ss ) as in normal operation mode.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 752 26.5 rewriting by self programming 26.5.1 overview the v850es/jj2 supports a flash macro service that allows the user program to rewrite the internal flash memory by itself. by using this interface and a self programming library that is used to rewrit e the flash memory with a user application program, the flash memory can be rewritten by a user application transferred in advance to the internal ram or external memory. consequently, the user program c an be upgraded and constant data can be rewritten in the field. figure 26-15. concept of self programming application program self programming library flash macro service flash memory flash function execution flash information erase, write
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 753 26.5.2 features (1) secure self programming (boot swap function) the v850es/jj2 supports a boot swap f unction that can exchange the physi cal memory of blocks 0 and 1 with the physical memory of blocks 2 and 3. by writing t he start program to be rewritten to blocks 2 and 3 in advance and then swapping the physical memory, the ent ire area can be safely rewritten even if a power failure occurs during rewriting because the correct user program always exists in blocks 0 and 1. figure 26-16. rewriting entire memory area (boot swap) block 15 block 5 block 4 block 3 block 2 block 1 block 0 block 15 block 5 block 4 block 3 block 2 block 1 block 0 block 15 boot swap rewriting blocks 2 and 3 block 5 block 4 block 3 block 2 block 1 block 0 (2) interrupt support instructions cannot be fetched from the flash memory dur ing self programming. conventionally, a user handler written to the flash memory could not be used even if an interrupt occurred. with the v850es/jj2, a user handler can be registered to an entry ram area by using a library function, so that interrupt servicing can be performed by in ternal ram or external memory execution.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 754 26.5.3 standard self programming flow the entire processing to rewrite the flash memory by flash self programming is illustrated below. figure 26-17. standard self programming flow flash environment initialization processing erase processing write processing flash information setting processing note 1 internal verify processing boot area swap processing note 2 flash environment end processing flash memory manipulation end of processing all blocks end? ? disable accessing flash area ? disable setting of stop mode ? disable stopping clock yes no notes 1. if a security setting is not performed, flash in formation setting processing does not have to be executed. 2. if boot swap is not used, flash information setting processing and boot swap processing do not have to be executed.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 755 26.5.4 flash functions table 26-9. flash function list function name outline support flashenv initialization of flash control macro flashblockerase erasure of only specified one block flashwordwrite writing from specified address flashblockiverify internal verification of specified one block flashblockblankcheck blank check of specified one block flashflmdcheck check of flmd pin flashstatuscheck status check of o peration specified immediately before flashgetinfo reading of flash information flashsetinfo setting of flash information flashbootswap swapping of boot area flashsetuserhandler user interrup t handler registration function 26.5.5 pin processing (1) flmd0 pin the flmd0 pin is used to set the operation mode when re set is released and to protect the flash memory from being written during self rewriting. it is therefore necessary to keep the voltage applied to the flmd0 pin at 0 v when reset is released and a normal operation is exec uted. it is also necessary to apply a voltage of v dd level to the flmd0 pin during the self programming m ode period via port control before the memory is rewritten. when self programming has been completed, the volt age on the flmd0 pin must be returned to 0 v. figure 26-18. mode change timing reset signal flmd0 pin v dd 0 v v dd 0 v self programming mode normal operation mode normal operation mode caution make sure that the flmd0 pin is at 0 v when reset is released.
chapter 26 flash memory preliminary user's manual u17714ej1v0ud 756 26.5.6 internal resources used the following table lists the internal resources used for se lf programming. these internal resources can also be used freely for purposes ot her than self programming. table 26-10. internal resources used resource name description entry ram area (124 bytes of either internal ram/external ram) routines and parameters used for the flash macr o service are located in this area. the entry program and default parameters are copied by calling a library initialization function. stack area (user stack + 300 bytes) an extension of the stack used by the user is used by the library (can be used in both the internal ram and external ram). library code (1900 bytes) program entity of library (can be used anywhere other than the flash memory block to be manipulated). application program executed as user application. calls flash functions. maskable interrupt can be used in the user application ex ecution status or self programming status. to use this interrupt in the self programming status, the interrupt servicing start address must be registered in advance by a registration function. nmi interrupt can be used in the user application exec ution status or self programming status. to use this interrupt in the self programming status, the interrupt servicing start address must be registered in advance by a registration function.
preliminary user's manual u17714ej1v0ud 757 chapter 27 on-chip debug function the v850es/jj2 has an on-chip debug function that uses the jtag (joint test acti on group) interface (drst, dck, dms, ddi, and ddo pins) and that can be used via an on-chip debug emulator (minicube ? ). 27.1 features hardware break function: 2 points software break function: 4 points real-time ram monitor function: memory cont ents can be read during program execution. dynamic memory modification function (dmm function): ram contents can be rewritten during program execution. mask function: reset, nmi, hldrq, wait rom security function: 10-byte id code authentication caution the following func tions are not supported. ? trace function ? event function ? debug interrupt inte rface function (dbint)
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 758 27.2 connection circuit example minicube v850es/jj2 vdd dck dms ddi ddo drst reset flmd0 gnd ev dd dck dms ddi ddo drst note 2 reset flmd0 note 3 flmd1/pdl5 ev ss note 1 status target power notes 1. example of pin connection wh en minicube is not connected 2. a pull-down resistor is provided on chip. 3. for flash memory rewriting 27.3 interface signals the interface signals are described below. (1) drst this is a reset input signal for the on-chip debug un it. it is a negative-logic signal that asynchronously initializes the debug control unit. minicube raises the drst signal when it detects v dd of the target system after the integrated debugger is started, and starts the on-chip debug unit of the device. when the drst signal goes high, a reset signal is also generated in the cpu. when starting debugging by starti ng the integrated debugger, a cpu reset is always generated. (2) dck this is a clock input signal. it supplies a 20 mhz cl ock from minicube. in the on-chip debug unit, the dms and ddi signals are sampled at the rising edge of the dck signal, and the data ddo is output at its falling edge.
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 759 (3) dms this is a transfer mode select signal. the transfer st atus in the debug unit changes depending on the level of the dms signal. (4) ddi this is a data input signal. it is sampled in the on-chip debug unit at the rising edge of dck. (5) ddo this is a data output signal. it is output from the on- chip debug unit at the falling edge of the dck signal. (6) ev dd this signal is used to detect vdd of the target system. if vdd from t he target system is not detected, the signals output from minicube (drst, dck, dms, ddi, flmd0, and reset) go into a high-impedance state. (7) flmd0 the flash self programming function is used for the function to download data to the flash memory via the integrated debugger. during flash self programming, the flmd0 pin must be kept high. in addition, connect a pull-down resistor to the flmd0 pin. the flmd0 pin can be controlled in either of the following two ways. <1> to control from minicube connect the flmd0 signal of minicube to the flmd0 pin. in the normal mode, nothing is dr iven by minicube (high impedance). during a break, minicube raises the flmd0 pin to the high level when the download function of the integrated debugger is executed. <2> to control from port connect any port of the device to the flmd0 pin. the same port as the one used by the user program to realize the fl ash self programming function may be used. on the console of the integrated debugger, make a setting to raise the port pin to high level before executing the download function, or lower the port pin after executing the download function. for details, refer to the id850qb ver. 3.10 integrated de bugger operation user 's manual (u17435e) . (8) reset this is a system reset input pin. if the drst pin is ma de invalid by the value of the ocdm0 bit of the ocdm register set by the user program, on-chip debugging cannot be executed. therefore, reset is effected by minicube, using the reset pin, to make the drst pin valid (initialization).
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 760 27.4 register (1) on-chip debug m ode register (ocdm) the ocdm register is used to sele ct the normal operation mode or on-chip debug mode. this register is a special register and can be written only in a combination of specific sequences (see 3.4.7 special registers ). this register is also used to specify whether a pi n provided with an on-chip debug function is used as an on- chip debug pin or as an ordinary port/peripheral function pin. it also is used to disconnect the internal pull- down resistor of the p05/intp2/drst pin. the ocdm register can be written only while a low level is input to the drst pin. this register can be read or written in 8-bit or 1-bit units.
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 761 0 ocdm0 0 1 operation mode ocdm 0 0 0 0 0 0 ocdm0 after reset: 01h note r/w address: fffff9fch when drst pin is low: normal operation mode (in which a pin that functions alternately as an on-chip debug function pin is used as a port/peripheral function pin) when drst pin is high: on-chip debug mode (in which a pin that functions alternately as an on-chip debug function pin is used as an on-chip debug mode pin) selects normal operation mode (in which a pin that functions alternately as on-chip debug function pin is used as a port/peripheral function pin) and disconnects the on-chip pull-down resistor of the p05/intp2/drst pin. < > note reset input sets this register to 01h. after rese t by the wdt2res signal, clock monitor (clm), or low- voltage detector (lvi), however, the val ue of the ocdm register is retained. cautions 1. when using the ddi, ddo, dck, and dms pins not as on-chip debug pins but as port pins after external reset, any of the following actions must be taken. ? input a low level to the p05/intp2/drst pin. ? set the ocdm0 bit. in this case, take the following actions. <1> clear the ocdm0 bit to 0. <2> fix the p05/intp2/drst pin to the low level until <1> is completed. 2. the drst pin has an on-chip pull-down resist or. this resistor is disconnected when the ocdm0 flag is cleared to 0. ocdm0 flag (1: pull-down on, 0: pull-down off) 10 to 100 k ? (30 k ? (typ.)) drst
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 762 27.5 operation the on-chip debug function is made invalid under the conditions shown in the table below. when this function is not used, keep the drst pin low until the ocdm.ocdm0 flag is cleared to 0. ocdm0 flag drst pin 0 1 l invalid invalid h invalid valid remark l: low-level input h: high-level input figure 27-1. timing when on-chip debug function is not used low-level input after ocdm0 bit is cleared, high level can be input/output. clearing ocdm0 bit releasing reset reset ocdm0 p05/intp2/drst
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 763 27.6 rom security function 27.6.1 security id the flash memory versions of the v850es/jj2 perform authentication using a 10-byte id code to prevent the contents of the flash memory from being read by an unaut horized person during on-chip debugging by the on-chip debug emulator. set the id code in the 10-byte on-chip flash memory area from 0000070h to 0000079h to allow the debugger perform id authentication. if the ids match, the security is released and reading fl ash memory and using the on-chip debug emulator are enabled. ? set the 10-byte id code to 0000070h to 0000079h. ? bit 7 of 0000079h is the on-chip debug emul ator enable flag (0: disable, 1: enable). ? when the on-chip debug emulator is started, the debugger requests id input. when the id code input on the debugger and the id code set in 0000070h to 0000079h match, the debugger starts. ? debugging cannot be performed if the on-chip debug emul ator enable flag is 0, even if the id codes match. 000007ah 000007fh 0000080h 0000079h 0000070h 0000000h system reserved area security id (10 bytes) caution when the data in the flash memory has been erased, all the bits are set to 1.
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 764 27.6.2 setting example when the following values are set to addresses 0x70 to 0x79 address value 0x70 0x12 0x71 0x34 0x72 0x56 0x73 0x78 0x74 0x9a 0x75 0xbc 0x76 0xde 0x77 0xf1 0x78 0x23 0x79 0xd4 the following shows program exampl es when the ca850 is used. [program example] enter the 10-byte security code using t he "security_id" section (address 0x70). #--------------------------------------- # security_id #--------------------------------------- .section "security_id" .word 0x78563412 --0-3 byte code .word 0xf1debc9a --4-7 byte code .hword 0xd423 --8-9 byte code
chapter 27 on-chip debug function preliminary user's manual u17714ej1v0ud 765 27.7 cautions (1) if a reset signal is input (from the target system or a reset signal from an internal reset source) during run (program execution), the br eak function may malfunction. (2) even if the reset signal is masked by the mask function, the i/o buffer (port pin) ma y be reset if a reset signal is input from a pin. (3) because a software breakpoint set in the internal flas h memory is made temporarily invalid by target reset or internal reset generated by watchdog timer 2. the br eakpoint becomes valid again when a hardware break or forced break occurs, but a software break does not occur until then. (4) pin reset during a break is masked and the cpu and per ipheral i/o are not reset. if pi n reset or internal reset is generated as soon as the flash memo ry is rewritten by dma or read by the ram monitor function while the user program is being executed, the cpu and peripheral i/o may not be correctly reset. (5) when the following conditions (a) and (b) are sati sfied and operation is stoppe d on the emulator (iecube ? , minicube) due to a break, etc., watchdog timer 2 does not stop and a reset or non-maskable interrupt occurs. when a reset occurs, the debugger hangs up. (a) the main clock or subclock is used as the source clock for watchdog timer 2. (b) the internal oscillation clock is stopped (rcm.rstop bit = 1). to avoid this, perform either of the following. ? when an emulator is used, use the internal oscillation clock as the source clock. ? when an emulator is used, do not stop the internal oscillator. (6) when the following conditions (a) and (b) are satisf ied and operation is stopped on the emulator (iecube, minicube) due to a break, etc., tmm does not stop even if the peripheral break function is set to "break". (a) either the intwt, internal oscillation clock (f r /8), or subclock are selected as the tmm source clock. (b) the main clock is stopped. to avoid this, perform either of the following. ? when an emulator is used, the main clock (f xx , f xx /2, f xx /4, f xx /64, f xx /512) is used as the source clock. ? when an emulator is used, disable the main clock oscillation. (7) in the on-chip debug mode, the ddo pin is forcibly set to the high-level output.
preliminary user's manual u17714ej1v0ud 766 chapter 28 electrical specifications (target) absolute maximum ratings (t a = 25 c) (1/2) parameter symbol conditions ratings unit v dd v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v bv dd ? 0.5 to +4.6 v ev dd v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v av ref0 v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v av ref1 v dd = ev dd = av ref0 = av ref1 ? 0.5 to +4.6 v v ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v av ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v bv ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v supply voltage ev ss v ss = ev ss = bv ss = av ss ? 0.5 to +0.5 v v i1 reset, flmd0 ? 0.5 to ev dd + 0.5 note 1 v v i2 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 ? 0.5 to bv dd + 0.5 note 1 v v i3 p10, p11 ? 0.5 to av ref1 + 0.5 note 1 v v i4 x1, x2, xt1, xt2 ? 0.5 to v ro note 2 + 0.5 note 1 v input voltage v i5 p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 ? 0.5 to +6.0 v analog input voltage v ian p70 to p715 ? 0.5 to av ref0 + 0.5 note 1 v notes 1. be sure not to exceed the absolute maximum ratings (max. value) of each supply voltage. 2. on-chip regulator output voltage (2.5 v (typ.))
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 767 absolute maximum ratings (t a = 25 c) (2/2) parameter symbol conditions ratings unit per pin 4 ma p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 total of all pins 50 ma per pin 4 ma pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 total of all pins 50 ma per pin 4 ma p10, p11 total of all pins 8 ma per pin 4 ma output current, low i ol p70 to p715 total of all pins 20 ma per pin ? 4 ma p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 total of all pins ? 50 ma per pin ? 4 ma pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 total of all pins ? 50 ma per pin ? 4 ma p10, p11 total of all pins ? 8 ma per pin ? 4 ma output current, high i oh p70 to p715 total of all pins ? 20 ma operating ambient temperature t a ? 40 to +85 c storage temperature t stg ? 40 to +125 c cautions 1. do not directly connect the output (or i /o) pins of ic products to each other, or to v dd , v cc , and gnd. open-drain pins or open-collector pins , however, can be direct ly connected to each other. direct connection of the output pins between an ic product and an external circuit is possible, if the output pins can be set to th e high-impedance state and the ou tput timing of the external circuit is designed to avoid output conflict. 2. product quality may suffer if the absolute m aximum rating is exceeded even momentarily for any parameter. that is, the absolute maximum ra tings are rated values at which the product is on the verge of suffering physical damage, and therefore the product must be used under conditions that ensure that the absolute maxi mum ratings are not exceeded. the ratings and conditions indicated for dc characteristics and ac characteristics represent the quality assurance range during normal operation. remark unless specified otherwise, the characte ristics of alternate-function pins are the same as those of port pins.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 768 capacitance (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit i/o capacitance c io f x = 1 mhz unmeasured pins returned to 0 v 10 pf operating conditions (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) supply voltage internal system clo ck frequency conditions v dd ev dd bv dd av ref0 , av ref1 unit c = 4.7 f (preliminary value), a/d converter stopped, d/a converter stopped 2.85 to 3.6 2.85 to 3.6 2.7 to 3.6 2.85 to 3.6 v f xx = 2.5 to 20 mhz c = 4.7 f (preliminary value), a/d converter operating, d/a converter operating 3.0 to 3.6 3.0 to 3.6 2.7 to 3.6 3.0 to 3.6 v f xt = 32.768 khz c = 4.7 f (preliminary value), a/d converter stopped, d/a converter stopped 2.85 to 3.6 2.85 to 3.6 2.7 to 3.6 2.85 to 3.6 v
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 769 main clock oscillator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) resonator circuit example parameter conditions min. typ. max. unit oscillation frequency (f x ) note 1 2.5 10 mhz after reset is released 2 16 /f x s after stop mode is released 1 note 4 note 3 ms ceramic resonator/ crystal resonator x2 x1 oscillation stabilization time note 2 after idle2 mode is released 350 note 4 note 3 s notes 1. the oscillation frequency shown above indicates only os cillator characteristics. use the v850es/jj2 so that the internal operation conditions do not exceed the ratings shown in ac characteristics and dc characteristics . 2. time required from start of oscillation until the resonator stabilizes. 3. the value varies depending on the setting of the osts register. 4. time required to set up the flash memory. se cure the setup time using the osts register. cautions 1. when using the main clock oscillator, wire as follows in the area enclo sed by the broken lines in the above figure to avoid an adver se effect from wiring capacitance. ? keep the wiring length as short as possible. ? do not cross the wiring with the other signal lines. ? do not route the wiring near a signal line through which a high fluctuating current flows. ? always make the ground point of the o scillator capacitor the same potential as v ss . ? do not ground the capacitor to a ground pattern through which a high current flows. ? do not fetch signals from the oscillator. 2. when the main clock is stopped and the devi ce is operating on the subclock, wait until the oscillation stabilization time has been secured by the program before switching back to the main clock. 3. for the resonator selection a nd oscillator constant, customers ar e requested to either evaluate the oscillation themselves or apply to th e resonator manufacturer for evaluation.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 770 subclock oscillator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) resonator circuit example parameter conditions min. typ. max. unit oscillation frequency (f xt ) note 1 32 32.768 35 khz crystal resonator xt2 xt1 oscillation stabilization time note 2 10 s notes 1. the oscillation frequency shown above indicates only osc illator characteristics. use the v850es/jj2 so that the internal operation conditions do not exceed the ratings shown in ac characteristics and dc characteristics . 2. time required from when v dd reaches the oscillation voltage range (2.85 v (min.)) to when the crystal resonator stabilizes. cautions 1. when using the subclock oscillator, wire as follows in the ar ea enclosed by the broken lines in the above figures to avoid an adver se effect from wiring capacitance. ? keep the wiring length as short as possible.  do not cross the wiring with the other signal lines.  do not route the wiring near a signal line through which a high fluctuating current flows.  always make the ground point of the oscillator capacitor the same potential as v ss .  do not ground the capacitor to a ground pattern through which a high current flows.  do not fetch signals from the oscillator. 2. the subclock oscillator is designed as a low-am plitude circuit for reducing power consumption, and is more prone to malf unction due to noise than the main clock oscillator. particular care is theref ore required with the wiring method when the subclock is used. 3. for the resonator selection a nd oscillator constant, customers ar e requested to either evaluate the oscillation themselves or apply to th e resonator manufacturer for evaluation.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 771 pll characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit 4 mode 2.5 5 mhz input frequency f x 8 mode 2.5 2.5 mhz 4 mode 10 20 mhz output frequency f xx 8 mode 20 20 mhz lock time t pll after v dd reaches 2.85 v (min.) 800 s internal oscillator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit output frequency f r 100 200 400 khz regulator characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit input voltage v dd f xx = 20 mhz (max.) 2.85 3.6 v output voltage v ro 2.5 v regulator output stabilization time t reg after v dd reaches 2.85 v (min.), stabilization capacitance c = 4.7 f (preliminary value) connected to regc pin 1 ms v dd v ro t reg reset
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 772 dc characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) (1/3) parameter symbol conditions min. typ. max. unit v ih1 reset, flmd0 0.8ev dd ev dd v v ih2 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 0.8ev dd 5.5 v v ih3 p38, p39, p40, p41, p90, p91 0.7ev dd 5.5 v v ih4 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 0.7bv dd bv dd v v ih5 p70 to p715 0.7av ref0 av ref0 v input voltage, high v ih6 p10, p11 0.7av ref1 av ref1 v v il1 reset, flmd0 ev ss 0.2ev dd v v il2 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 ev ss 0.2ev dd v v il3 p38, p39, p40, p41, p90, p91 ev ss 0.3ev dd v v il4 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 bv ss 0.3bv dd v v il5 p70 to p715 av ss 0.3av ref0 v input voltage, low v il6 p10, p11 av ss 0.3av ref1 v input leakage current, high i lih v i = v dd = ev dd = bv dd = av ref0 = av ref1 5 a input leakage current, low i lil v i = 0 v ? 5 a output leakage current, high i loh v o = v dd = ev dd = bv dd = av ref0 = av ref1 5 a output leakage current, low i lol v o = 0 v ? 5 a remark unless specified otherwise, the characte ristics of alternate-function pins are the same as those of port pins.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 773 dc characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) (2/3) parameter symbol conditions min. typ. max. unit per pin i oh = ? 1.0 ma total of all pins ? 20 ma ev dd ? 1.0 ev dd v v oh1 p00 to p06, p30 to p39, p40 to p42, p50 to p55, p60 to p615, p80, p81, p90 to p915 per pin i oh = ? 100 a total of all pins ? 6.0 ma ev dd ? 0.5 ev dd v per pin i oh = ? 1.0 ma total of all pins ? 20 ma bv dd ? 1.0 bv dd v v oh2 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 per pin i oh = ? 100 a total of all pins ? 5.0 ma bv dd ? 0.5 bv dd v per pin i oh = ? 0.4 ma total of all pins ? 6.4 ma av ref0 ? 1.0 av ref0 v v oh3 p70 to p715 per pin i oh = ? 100 a total of all pins ? 1.6 ma av ref0 ? 0.5 av ref0 v per pin i oh = ? 0.4 ma total of all pins ? 0.8 ma av ref1 ? 1.0 av ref1 v output voltage, high v oh4 p10, p11 per pin i oh = ? 100 a total of all pins ? 0.2 ma av ref1 ? 0.5 av ref1 v v ol1 p00 to p06, p30 to p37, p42, p50 to p55, p60 to p615, p80, p81, p92 to p915 per pin i ol = 1.0 ma 0 0.4 v v ol2 p38, p39, p40, p41, p90, p91 per pin i ol = 3.0 ma total of all pins 20 ma 0 0.4 v v ol3 pcd0 to pcd3, pcm0 to pcm5, pcs0 to pcs7, pct0 to pct7, pdh0 to pdh7, pdl0 to pdl15 per pin i ol = 1.0 ma total of all pins 20 ma 0 0.4 v output voltage, low v ol4 p10, p11, p70 to p715 per pin i ol = 0.4 ma total of all pins 7.2 ma 0 0.4 v software pull-down resistor r 1 p05 v i = v dd 10 30 100 k ? remarks 1. unless specified otherwise, the characteristics of alte rnate-function pins are t he same as those of port pins. 2. when the i oh and i ol conditions are not satisfied for a pin but the to tal value of all pins is satisfied, only that pin does not satisfy the dc characteristics.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 774 dc characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) (3/3) parameter symbol conditions min. typ. max. unit note 2 35 55 ma i dd1 normal operation f xx = 20 mhz (f x = 5 mhz) note 3 34 54 ma note 2 20 30 ma i dd2 halt mode f xx = 20 mhz (f x = 5 mhz) note 3 19 28 ma i dd3 idle1 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.8 1.6 ma i dd4 idle2 mode f xx = 5 mhz (f x = 5 mhz), pll off 0.3 0.8 ma note 2 300 600 a i dd5 subclock operating mode f xt = 32.768 khz, main clock, internal oscillator stopped note 3 200 400 a note 2 18 100 a i dd6 sub-idle mode f xt = 32.768 khz, main clock, internal oscillator stopped note 3 18 80 a subclock stopped, internal oscillator stopped 7 50 a subclock operating, internal oscillator stopped 10 60 a i dd7 stop mode subclock stopped, internal oscillator operating 10 60 a note 2 38 61 ma supply current note 1 i dd8 flash memory programming mode f xx = 20 mhz (f x = 5 mhz) note 3 37 60 ma notes 1. to t a l o f v dd , ev dd , and bv dd currents. current flowing through t he output buffers, a/d converter, d/a converter, and on-chip pull-down resistor is not included. 2. pd70f3723, 70f3724 3. pd70f3720, 70f3721, 70f3722
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 775 data retention characteristics in stop mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. typ. max. unit data retention voltage v dddr stop mode (all functions stopped) 1.9 3.6 v data retention current i dddr stop mode (all functions stopped) 7 50 a supply voltage rise time t rvd 200 s supply voltage fall time t fvd 200 s supply voltage retention time t hvd after stop mode setting 0 ms stop release signal input time t drel after v dd reaches 2.85 v (min.) 0 ms data retention input voltage, high v ihdr v dd = ev dd = bv dd = v dddr 0.9v dddr v dddr v data retention input voltage, low v ildr v dd = ev dd = bv dd = v dddr 0 0.1v dddr v caution shifting to stop mode and restoring from stop mode must be performed within the rated operating range. t drel t hvd t fvd t rvd stop release signal input stop mode setting v dddr v ihdr v ihdr v ildr v dd /ev dd /bv dd reset (input) stop mode release interrupt (nmi, etc.) (released by falling edge) stop mode release interrupt (nmi, etc.) (released by rising edge) operating voltage lower limit
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 776 ac characteristics ac test input measurement points (v dd , av ref0 , av ref1 , ev dd , bv dd ) v dd 0 v v ih v il v ih v il measurement points ac test output measurement points v oh v ol v oh v ol measurement points load conditions dut (device under measurement) c l = 50 pf caution if the load capaci tance exceeds 50 pf due to the circ uit configuration, bring the load capacitance of the device to 50 pf or less by in serting a buffer or by some other means.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 777 clkout output timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v) parameter symbol conditions min. max. unit output cycle t cyk <1> 50 ns 31.25 s high-level width t wkh <2> t cyk /2 ? 10 ns low-level width t wkl <3> t cyk /2 ? 10 ns rise time t kr <4> 10 ns fall time t kf <5> 10 ns clock timing clkout (output) <1> <2> <3> <4> <5>
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 778 bus timing (1) in multiplexed bus mode caution when operating at f xx > 20 mhz, be sure to insert address hold waits and address setup waits. (a) read/write cycle (clkout asynchronous) (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit address setup time (to astb ) t sast <6> (0.5 + t asw )t ? 20 ns address hold time (from astb ) t hsta <7> (0.5 + t ahw )t ? 15 ns delay time from rd to address float t frda <8> 16 ns data input setup time from address t said <9> (2 + n + t asw + t ahw )t ? 35 ns data input setup time from rd t srid <10> (1 + n)t ? 25 ns delay time from astb to rd, wrm t dstrdwr <11> (0.5 + t ahw )t ? 15 ns data input hold time (from rd ) t hrdid <12> 0 ns address output time from rd t drda <13> (1 + i)t ? 15 ns delay time from rd, wrm to astb t drdwrst <14> 0.5t ? 15 ns delay time from rd to astb t drdst <15> (1.5 + i + t asw )t ? 15 ns rd, wrm low-level width t wrdwrl <16> (1 + n)t ? 15 ns astb high-level width t wsth <17> (1 + i + t asw )t ? 15 ns data output time from wrm t dwrod <18> 15 ns data output setup time (to wrm ) t sodwr <19> (1 + n)t ? 20 ns data output hold time (from wrm ) t hwrod <20> t ? 15 ns t sawt1 <21> n 1 (1.5 + t asw + t ahw )t ? 35 ns wait setup time (to address) t sawt2 <22> (1.5 + n + t asw + t ahw )t ? 35 ns t hawt1 <23> n 1 (0.5 + n + t asw + t ahw )t ns wait hold time (from address) t hawt2 <24> (1.5 + n + t asw + t ahw )t ns t sstwt1 <25> n 1 (1 + t ahw )t ? 25 ns wait setup time (to astb ) t sstwt2 <26> (1 + n + t ahw )t ? 25 ns t hstwt1 <27> n 1 (n + t ahw )t ns wait hold time (from astb ) t hstwt2 <28> (1 + n + t ahw )t ns remarks 1. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 2. t = 1/f cpu (f cpu : cpu operating clock frequency) 3. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 4. m = 0, 1 5. i: number of idle states inserted after a read cycle (0 or 1) 6. the values in the above specific ations are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 779 read cycle (clkout asynchronous ): in multiplexed bus mode clkout (output) cs0 to cs3 (output) a16 to a23 (output) ad0 to ad15 (i/o) astb (output) rd (output) wait (input) t1 t2 tw t3 data address hi-z <6> <7> <17> <9> <12> <14> <10> <11> <25> <27> <26> <28> <21> <23> <22> <24> <16> <8> <13> <15> remark wr0 and wr1 are high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 780 write cycle (clkout asynchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) wr0, wr1 (output) astb (output) wait (input) t1 t2 tw t3 data address <25> <27> <26> <28> <21> <23> <22> <24> <6> <17> <7> <14> <20> <19> <16> <11> <18> cs0 to cs3 (output) a16 to a23 (output) remark rd is high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 781 (b) read/write cycle (clkout synchronous): in multiplexed bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit delay time from clkout to address t dka <29> 0 25 ns delay time from clkout to address float t fka <30> 0 19 ns delay time from clkout to astb t dkst <31> ? 12 7 ns delay time from clkout to rd, wrm t dkrdwr <32> ? 5 14 ns data input setup time (to clkout ) t sidk <33> 15 ns data input hold time (from clkout ) t hkid <34> 5 ns data output delay time from clkout t dkod <35> 19 ns wait setup time (to clkout ) t swtk <36> 20 ns wait hold time (from clkout ) t hkwt <37> 5 ns remarks 1. m = 0, 1 2. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. read cycle (clkout synchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) cs0 to cs3 (output) a16 to a23 (output) astb (output) rd (output) wait (input) t1 t2 tw t3 data address hi-z <29> <31> <32> <30> <31> <32> <36> <36> <37> <37> <33> <34> remark wr0 and wr1 are high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 782 write cycle (clkout synchronous ): in multiplexed bus mode clkout (output) ad0 to ad15 (i/o) astb (output) wr0, wr1 (output) wait (input) t1 t2 tw t3 data address <29> <31> <32> <32> <37> <37> <36> <36> <31> <35> cs0 to cs3 (output) a16 to a23 (output) remark rd is high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 783 (2) in separate bus mode caution when operating at f xx > 20 mhz, be sure to insert an address hold wait and address setup wait. (a) read cycle (clkout asynchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit address setup time (to rd ) t sard <38> (0.5 + t asw )t ? 23 ns address hold time (from rd ) t hard <39> it + 1 ns rd low-level width t wrdl <40> (1.5 + n + t ahw )t ? 10 ns data setup time (to rd ) t sisd <41> 23 ns data hold time (from rd ) t hisd <42> 0 ns data setup time (to address) t said <43> (2 + n + t asw + t ahw )t ? 40 ns t srdwt1 <44> (0.5 + t ahw )t ? 25 ns wait setup time (to rd ) t srdwt2 <45> (0.5 + n + t ahw )t ? 25 ns t hrdwt1 <46> (n ? 0.5 + t ahw )t ns wait hold time (from rd ) t hrdwt2 <47> (n + 0.5 + t ahw )t ns t sawt1 <48> (1 + t asw + t ahw )t ? 45 ns wait setup time (to address) t sawt2 <49> (1 + n + t asw + t ahw )t ? 45 ns t hawt1 <50> (1 + t asw + t ahw )t ns wait hold time (from address) t hawt2 <51> (1 + n + t asw + t ahw )t ns remarks 1. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 2. t = 1/f cpu (f cpu : cpu operating clock frequency) 3. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted 4. i: number of idle states inserted after a read cycle (0 or 1) 5. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 784 read cycle (clkout asynchr onous): in separate bus mode clkout (output) t1 <43> hi-z hi-z <38> <40> <47> <45> <46> <44> <48> <50> <49> <51> <42> <41> <39> tw t2 rd (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) remark wr0 and wr1 are high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 785 (b) write cycle (clkout asynchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit address setup time (to wrm ) t sawr <52> (1 + t asw + t ahw )t ? 23 ns address hold time (from wrm ) t hawr <53> 0.5t ? 10 ns wrm low-level width t wwrl <54> (0.5 + n)t ? 10 ns data output time from wrm t dosdw <55> ? 5 ns data setup time (to wrm ) t sosdw <56> (0.5 + n)t ? 20 ns data hold time (from wrm ) t hosdw <57> 0.5t ? 10 ns data setup time (to address) t saod <58> (1 + t asw + t ahw )t ? 25 ns t swrwt1 <59> 22 ns wait setup time (to wrm ) t swrwt2 <60> nt ? 22 ns t hwrwt1 <61> 0 ns wait hold time (from wrm ) t hwrwt2 <62> nt ns t sawt1 <63> (1 + t asw + t ahw )t ? 45 ns wait setup time (to address) t sawt2 <64> (1 + n + t asw + t ahw )t ? 45 ns t hawt1 <65> (n + t asw + t ahw )t ns wait hold time (from address) t hawt2 <66> (1 + n + t asw + t ahw )t ns remarks 1. m = 0, 1 2. t asw : number of address setup wait clocks t ahw : number of address hold wait clocks 3. t = 1/f cpu (f cpu : cpu operating clock frequency) 4. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 5. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 786 write cycle (clkout asynchr onous): in separate bus mode clkout (output) t1 <58> <52> <55> <54> <62> <60> <61> <59> <63> <65> <64> <66> <57> <56> <53> tw t2 wr0, wr1 (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) hi-z hi-z remark rd is high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 787 (c) read cycle (clkout synchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit delay time from clkout to address, cs t dksa <67> 2 25 ns data input setup time (to clkout ) t sisdk <68> 20 ns data input hold time (from clkout ) t hkisd <69> 0 ns delay time from clkout to rd t dksr <70> ? 2 12 ns wait setup time (to clkout ) t swtk <71> 20 ns wait hold time (from clkout ) t hkwt <72> 0 ns remark the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. read cycle (clkout synchronous, 1 wait): in separate bus mode clkout (output) t1 <70> <71> <72> <71> <72> <67> <70> <68> <69> hi-z hi-z tw t2 rd (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) <67> remark wr0 and wr1 are high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 788 (d) write cycle (clkout synchronous): in separate bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit delay time from clkout to address, cs t dksa <73> 2 25 ns delay time from clkout to data output t dksd <74> 2 15 ns delay time from clkout to wrm t dksw <75> ? 2 12 ns wait setup time (to clkout ) t swtk <76> 20 ns wait hold time (from clkout ) t hkwt <77> 0 ns remarks 1. m = 0, 1 2. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. write cycle (clkout synchronous ): in separate bus mode clkout (output) t1 <74> <75> <77> <76> <75> tw t2 wr0, wr1 (output) cs0 to cs3 (output) a0 to a23 (output) ad0 to ad15 (i/o) wait (input) <73> <73> <77> <76> <74> hi-z hi-z remark rd is high level.
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 789 (3) bus hold (a) clkout asynchronous (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit hldrq high-level width t whqh <78> t + 10 ns hldak low-level width t whal <79> t ? 15 ns delay time from hldak to bus output t dhac <80> ? 3 ns delay time from hldrq to hldak t dhqha1 <81> (2n + 7.5)t + 25 ns delay time from hldrq to hldak t dhqha2 <82> 0.5t 1.5t + 25 ns remarks 1. t = 1/f cpu (f cpu : cpu operating clock frequency) 2. n: number of wait clocks inserted in the bus cycle the sampling timing changes when a programmable wait is inserted. 3. the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. bus hold (clkout asynchronous) clkout (output) hldrq (input) hldak (output) address bus (output) data bus (i/o) th th th ti ti hi-z cs0 to cs3 (output) hi-z astb (output) rd (output), wr0, wr1 (output) hi-z hi-z <78> <82> <79> <80> <81>
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 790 (b) clkout synchronous (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit hldrq setup time (to clkout ) t shqk <83> 20 ns hldrq hold time (from clkout ) t hkhq <84> 5 ns delay time from clkout to bus float t dkf <85> 19 ns delay time from clkout to hldak t dkha <86> 19 ns remark the values in the above specifications are values for when clocks with a 1:1 duty ratio are input from x1. bus hold (clkout synchronous) clkout (output) hldrq (input) hldak (output) address bus (output) data bus (i/o) th th th t2 t3 ti ti hi-z cs0 to cs3 (output) hi-z astb (output) rd (output), wr0, wr1 (output) hi-z hi-z <83> <83> <86> <86> <84> <85>
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 791 power on/power off/reset timing (t a = ? 40 to +85 c, v ss = av ss = bv ss = ev ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit ev dd v dd t rel <87> 0 ns ev dd bv dd t reb <88> 0 t rel ns ev dd av ref0 , av ref1 t rea <89> 0 t rel ns ev dd reset t rer <90> 500 + t reg note ns analog noise elimination (during flash erase/ writing) 500 ns reset low-level width t wrsl <91> analog noise elimination 500 ns reset v dd t fre <92> 500 ns v dd ev dd t fel <93> 0 ns bv dd ev dd t feb <94> 0 t fel ns av ref0 ev dd t fea <95> 0 t fel ns note depends on the on-chip regulator characteristics. v dd ev dd bv dd v i v i v i v i av ref0 reset (input) <88> <87> <90> <92> <91> <89> <94> <93> <95> interrupt, flmd0 pin timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit nmi high-level width t wnih analog noise elimination 500 ns nmi low-level width t wnil analog noise elimination 500 ns n = 0 to 8 (analog noise elimination) 500 ns intpn high-level width t with n = 3 (digital noise elimination) 3t smp + 20 ns n = 0 to 8 (analog noise elimination) 500 ns intpn low-level width t witl n = 3 (digital noise elimination) 3t smp + 20 ns flmd0 high-level width t wmdh 500 ns flmd0 low-level width t wmdl 500 ns remark t smp : noise elimination sampling clock cycle
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 792 key return timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref 0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit krn high-level width t wkrh analog noise elimination 500 ns krn low-level width t wkrl analog noise elimination 500 ns remark n = 0 to 7 timer timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit ti high-level width t tih 2t + 20 ns ti low-level width t til tip00, tip01, tip10, tip11, tip20, tip21, tip30, tip31, tip40, tip41, tip50, tip51, tip60, tip61, tip70, tip71, tip80, tip81, tiq00 to tiq03 2t + 20 ns remark t = 1/f xx uart timing (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit transmit rate 312.5 kbps asck0 cycle time 10 mhz
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 793 csib timing (1) master mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit sckbn cycle time t kcy1 <96> 125 ns sckbn high-/low-level width t kh1 , t kl1 <97> t kcy1 /2 ? 5 ns sibn setup time (to sckbn ) t sik1 <98> 30 ns sibn hold time (from sckbn ) t ksi1 <99> 30 ns delay time from sckbn to sobn output t kso1 <100> 30 ns remark n = 0 to 5 (2) slave mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. max. unit sckbn cycle time t kcy2 <96> 125 ns sckbn high-/low-level width t kh2 , t kl2 <97> 57.5 ns sibn setup time (to sckbn ) t sik2 <98> 30 ns sibn hold time (from sckbn ) t ksi2 <99> 30 ns delay time from sckbn to sobn output t kso2 <100> 30 ns remark n = 0 to 5 sobn (output) input data output data sibn (input) sckbn (i/o) <96> <97> <97> <98> <99> <100> hi-z hi-z remark n = 0 to 5
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 794 i 2 c bus mode (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) normal mode high-speed mode parameter symbol min. max. min. max. unit scl0n clock frequency f clk 0 100 0 400 khz bus free time (between start and stop conditions) t buf <101> 4.7 ? 1.3 ? s hold time note 1 t hd: sta <102> 4.0 ? 0.6 ? s scl0n clock low-level width t low <103> 4.7 ? 1.3 ? s scl0n clock high-level width t high <104> 4.0 ? 0.6 ? s setup time for start/restart conditions t su: sta <105> 4.7 ? 0.6 ? s cbus compatible master 5.0 ? ? ? s data hold time i 2 c mode t hd: dat <106> 0 note 2 ? 0 note 2 0.9 note 3 s data setup time t su: dat <107> 250 ? 100 note 4 ? ns sda0n and scl0n signal rise time t r <108> ? 1000 20 + 0.1cb note 5 300 ns sda0n and scl0n signal fall time t f <109> ? 300 20 + 0.1cb note 5 300 ns stop condition setup time t su: sto <110> 4.0 ? 0.6 ? s pulse width of spike suppressed by input filter t sp <111> ? ? 0 50 ns capacitance load of each bus line cb ? 400 ? 400 pf notes 1. at the start condition, the first clock pulse is generated after the hold time. 2. the system requires a minimum of 300 ns hold ti me internally for the sda0n signal (at v ihmin. of scl0n signal) in order to occupy the undefined area at the falling edge of scl0n. 3. if the system does not extend the scl0n signal low hold time (t low ), only the maximum data hold time (t hd : dat ) needs to be satisfied. 4. the high-speed mode i 2 c bus can be used in the normal-mode i 2 c bus system. in this case, set the high-speed mode i 2 c bus so that it meets the following conditions. ? if the system does not extend the sc l0n signal's low state hold time: t su : dat 250 ns ? if the system extends the scl0n signal's low state hold time: transmit the following data bit to the sda0n line prior to the scl0n line release (t rmax. + t su:dat = 1,000 + 250 = 1,250 ns: normal mode i 2 c bus specification). 5. cb: total capacitance of one bus line (unit: pf) remark n = 0 to 2
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 795 i 2 c bus mode stop condition start condition restart condition stop condition scl0n (i/o) sda0n (i/o) <103> <109> <109> <108> <108> <106> <107> <105> <102> <101> <102> <111> <110> <104> remark n = 0 to 2 a/d converter (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , 3.0 v av ref0 3.6 v, v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit resolution 10 bit overall error note 3.0 av ref0 3.6 v 0.6 %fsr conversion time t conv 2.6 24 s zero scale error 0.5 %fsr full scale error 0.5 %fsr non-linearity error 4.0 lsb differential linearity error 4.0 lsb analog input voltage v ian av ss av ref0 v reference voltage av ref0 3.0 3.6 v normal conversion mode 3 6.5 ma high-speed conversion mode 4 10 ma av ref0 current ai ref0 when a/d converter unused 5 a note excluding quantization error ( 0.05 %fsr). caution do not set (read/write) alternate-function por ts during a/d conversion; otherwise the conversion resolution may be degraded. remark lsb: least significant bit fsr: full scale range
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 796 d/a converter (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , 3.0 v av ref1 3.6 v, v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit resolution 8 bit overall error note 1 r = 2 m ? 1.2 %fsr settling time c = 20 pf 3 s output resistor r o output data 55h 3.5 k ? reference voltage av ref1 3.0 3.6 v d/a conversion operating 1 2.5 ma av ref1 current note 2 ai ref1 d/a conversion stopped 5 a notes 1. excluding quantization error ( 0.5 lsb). 2. value of 1 channel of d/a converter remark r is the output pin load resistance and c is the output pin load capacitance. lvi circuit characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit detection voltage v lvi0 2.85 3.0 3.15 v response time note t ld after v dd reaches v lvi0 (max.), or after v dd has dropped to v lvi0 (max.) 0.2 2.0 ms minimum pulse width t lw 0.2 ms reference voltage stabilization wait time t lwait after v dd reaches 2.85 v (min.) 0.1 0.2 ms note time required to detect the detection volt age and output an interrupt or reset signal. supply voltage (v dd ) time detection voltage (min.) operating voltage (min.) detection voltage (typ.) detection voltage (max.) t lwait t lw t ld t ld lvion bit = 0 1
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 797 ram retention detection (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) parameter symbol conditions min. typ. max. unit detection voltage v ramh 1.9 2.0 2.1 v supply voltage rise time t ramhth v dd = 0 to 2.85 v 0.002 ms response time note t ramhd after v dd reaches 2.1 v 0.2 2.0 ms minimum pulse width t ramhw 0.2 ms note time required to detect the detection voltage and set the rams.ramf bit. supply voltage (v dd ) time detection voltage (min.) operating voltage (min.) detection voltage (typ.) detection voltage (max.) t ramhw t ramhd t ramhd t ramhth rams.ramf bit cleared by instruction
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 798 flash memory programming characteristics (t a = ? 40 to +85 c, bv dd v dd = ev dd = av ref0 = av ref1 , v ss = ev ss = bv ss = av ss = 0 v, c l = 50 pf) (1) basic characteristics parameter symbol conditions min. typ. max. unit operating frequency f cpu 2.5 20 mhz supply voltage v dd 2.85 3.6 v number of rewrites c wrt 100 times programming temperature t prg ? 40 +85 c (2) serial write operation characteristics parameter symbol conditions min. typ. max. unit flmd0, flmd1 setup time t mdset 2 3000 ms flmd0 count start time from reset t rfcf f x = 2.5 to 10 mhz 17855/f x + s flmd0 counter high-level width/ low-level width t ch /t cl 10 100 s flmd0 counter rise time/fall time t r /t f 50 s remark = oscillation stabilization time flash write mode setup timing v dd flmd1 0 v v dd reset (input) 0 v v dd flmd0 0 v t rfcf t cl t f t r t ch t mdset
chapter 28 electrical specifications (target) preliminary user's manual u17714ej1v0ud 799 (3) programming characteristics parameter symbol conditions min. typ. max. unit note 1 304 ms note 2 1405 ms block erase time f xx = 20 mhz note 3 3057 ms write time per 256 bytes f xx = 20 mhz 8.1 ms note 1 20 ms note 2 141 ms block internal verify time f xx = 20 mhz note 3 322 ms note 1 9.2 ms note 2 64 ms block blank check time f xx = 20 mhz note 3 147 ms flash memory information setting time f xx = 20 mhz 1.0 ms notes 1. block size = 4 kb 2. block size = 28 kb 3. block size = 64 kb caution when writing initially to sh ipped products, it is co unted as one rewrite for both "erase to write" and "write only". example (p: write, e: erase) shipped product ?? p e p e p: 3 rewrites shipped product e p e p e p: 3 rewrites
preliminary user's manual u17714ej1v0ud 800 chapter 29 package drawing 108 73 136 109 144 72 37 144-pin plastic lqfp (fine pitch) (20x20) item millimeters note a 22.0 0.2 b 20.0 0.2 c 20.0 0.2 d f 1.25 22.0 0.2 s144gj-50-uen s 1.5 0.1 k 1.0 0.2 l 0.5 0.2 r3 + 4 ? 3 g 1.25 h 0.22 0.05 i 0.08 j 0.5 (t.p.) m 0.17 n 0.08 p 1.4 q 0.10 0.05 + 0.03 ? 0.07 each lead centerline is located within 0.08 mm of its true position (t.p.) at maximum material condition. s s m detail of lead end i j f g h q r p k m l n cd s a b
preliminary user's manual u17714ej1v0ud 801 appendix a register index (1/12) symbol name unit page ada0cr0 a/d conversion result register 0 adc 454 ada0cr0h a/d conversion result register 0h adc 454 ada0cr1 a/d conversion result register 1 adc 454 ada0cr1h a/d conversion result register 1h adc 454 ada0cr2 a/d conversion result register 2 adc 454 ada0cr2h a/d conversion result register 2h adc 454 ada0cr3 a/d conversion result register 3 adc 454 ada0cr3h a/d conversion result register 3h adc 454 ada0cr4 a/d conversion result register 4 adc 454 ada0cr4h a/d conversion result register 4h adc 454 ada0cr5 a/d conversion result register 5 adc 454 ada0cr5h a/d conversion result register 5h adc 454 ada0cr6 a/d conversion result register 6 adc 454 ada0cr6h a/d conversion result register 6h adc 454 ada0cr7 a/d conversion result register 7 adc 454 ada0cr7h a/d conversion result register 7h adc 454 ada0cr8 a/d conversion result register 8 adc 454 ada0cr8h a/d conversion result register 8h adc 454 ada0cr9 a/d conversion result register 9 adc 454 ada0cr9h a/d conversion result register 9h adc 454 ada0cr10 a/d conversion result register 10 adc 454 ada0cr10h a/d conversion result register 10h adc 454 ada0cr11 a/d conversion result register 11 adc 454 ada0cr11h a/d conversion result register 11h adc 454 ada0cr12 a/d conversion result register 12 adc 454 ada0cr12h a/d conversion result register 12h adc 454 ada0cr13 a/d conversion result register 13 adc 454 ada0cr13h a/d conversion result register 13h adc 454 ada0cr14 a/d conversion result register 14 adc 454 ada0cr14h a/d conversion result register 14h adc 454 ada0cr15 a/d conversion result register 15 adc 454 ada0cr15h a/d conversion result register 15h adc 454 ada0m0 a/d converter mode register 0 adc 447 ada0m1 a/d converter mode register 1 adc 449 ada0m2 a/d converter mode register 2 adc 452 ada0pfm power-fail compare mode register adc 456 ada0pft power-fail compare threshold value register adc 457 ada0s a/d converter channel specification register adc 453 adic interrupt control register intc 668 awc address wait control register bcu 201 bcc bus cycle control register bcu 202 bsc bus size configuration register bcu 190
appendix a register index preliminary user's manual u17714ej1v0ud 802 (2/12) symbol name unit page cb0ctl0 csib0 control register 0 csi 524 cb0ctl1 csib0 control register 1 csi 527 cb0ctl2 csib0 control register 2 csi 528 cb0ric interrupt control register intc 667 cb0rx csib0 receive data register csi 523 cb0rxl csib0 receive data register l csi 523 cb0str csib0 status register csi 530 cb0tic interrupt control register intc 667 cb0tx csib0 transmit data register csi 523 cb0txl csib0 transmit data register l csi 523 cb1ctl0 csib1 control register 0 csi 524 cb1ctl1 csib1 control register 1 csi 527 cb1ctl2 csib1 control register 2 csi 528 cb1ric interrupt control register intc 667 cb1rx csib1 receive data register csi 523 cb1rxl csib1 receive data register l csi 523 cb1str csib1 status register csi 530 cb1tic interrupt control register intc 667 cb1tx csib1 transmit data register csi 523 cb1txl csib1 transmit data register l csi 523 cb2ctl0 csib2 control register 0 csi 524 cb2ctl1 csib2 control register 1 csi 527 cb2ctl2 csib2 control register 2 csi 528 cb2ric interrupt control register intc 667 cb2rx csib2 receive data register csi 523 cb2rxl csib2 receive data register l csi 523 cb2str csib2 status register csi 530 cb2tic interrupt control register intc 667 cb2tx csib2 transmit data register csi 523 cb2txl csib2 transmit data register l csi 523 cb3ctl0 csib3 control register 0 csi 524 cb3ctl1 csib3 control register 1 csi 527 cb3ctl2 csib3 control register 2 csi 528 cb3ric interrupt control register intc 667 cb3rx csib3 receive data register csi 523 cb3rxl csib3 receive data register l csi 523 cb3str csib3 status register csi 530 cb3tic interrupt control register intc 667 cb3tx csib3 transmit data register csi 523 cb3txl csib3 transmit data register l csi 523 cb4ctl0 csib4 control register 0 csi 524 cb4ctl1 csib4 control register 1 csi 527 cb4ctl2 csib4 control register 2 csi 528 cb4ric interrupt control register intc 668 cb4rx csib4 receive data register csi 523
appendix a register index preliminary user's manual u17714ej1v0ud 803 (3/12) symbol name unit page cb4rxl csib4 receive data register l csi 523 cb4str csib4 status register csi 530 cb4tic interrupt control register intc 668 cb4tx csib4 transmit data register csi 523 cb4txl csib4 transmit data register l csi 523 cb5ctl0 csib5 control register 0 csi 524 cb5ctl1 csib5 control register 1 csi 527 cb5ctl2 csib5 control register 2 csi 528 cb5ric interrupt control register intc 668 cb5rx csib5 receive data register csi 523 cb5rxl csib5 receive data register l csi 523 cb5str csib5 status register csi 530 cb5tic interrupt control register intc 668 cb5tx csib5 transmit data register csi 523 cb5txl csib5 transmit data register l csi 523 ccls cpu operation clock status register cg 219 ckc clock control register clm 222 clm clock monitor mode register cg 721 ctbp callt base pointer cpu 54 ctpc callt execution status saving register cpu 53 ctpsw callt execution status saving register cpu 53 da0cs0 d/a conversion value setting register 0 dac 481 da0cs1 d/a conversion value setting register 1 dac 481 da0m d/a converter mode register dac 480 dadc0 dma addressing control register 0 dma 632 dadc1 dma addressing control register 1 dma 632 dadc2 dma addressing control register 2 dma 632 dadc3 dma addressing control register 3 dma 632 dbc0 dma transfer count register 0 dma 631 dbc1 dma transfer count register 1 dma 631 dbc2 dma transfer count register 2 dma 631 dbc3 dma transfer count register 3 dma 631 dbpc exception/debug trap status saving register cpu 54 dbpsw exception/debug trap status saving register cpu 54 dchc0 dma channel control register 0 dma 633 dchc1 dma channel control register 1 dma 633 dchc2 dma channel control register 2 dma 633 dchc3 dma channel control register 3 dma 633 dda0h dma destination address register 0h dma 630 dda0l dma destination address register 0l dma 630 dda1h dma destination address register 1h dma 630 dda1l dma destination address register 1l dma 630 dda2h dma destination address register 2h dma 630 dda2l dma destination address register 2l dma 630 dda3h dma destination address register 3h dma 630
appendix a register index preliminary user's manual u17714ej1v0ud 804 (4/12) symbol name unit page dda3l dma destination address register 3l dma 630 dmaic0 interrupt control register intc 668 dmaic1 interrupt control register intc 668 dmaic2 interrupt control register intc 668 dmaic3 interrupt control register intc 668 dsa0h dma source address register 0h dma 629 dsa0l dma source address register 0l dma 629 dsa1h dma source address register 1h dma 629 dsa1l dma source address register 1l dma 629 dsa2h dma source address register 2h dma 629 dsa2l dma source address register 2l dma 629 dsa3h dma source address register 3h dma 629 dsa3l dma source address register 3l dma 629 dtfr0 dma trigger factor register 0 dma 634 dtfr1 dma trigger factor register 1 dma 634 dtfr2 dma trigger factor register 2 dma 634 dtfr3 dma trigger factor register 3 dma 634 dwc0 data wait control register 0 bcu 198 ecr interrupt source register cpu 51 eipc interrupt status saving register cpu 50 eipsw interrupt status saving register cpu 50 eximc external bus interface mode control register bcu 189 fepc nmi status saving register cpu 51 fepsw nmi status saving register cpu 51 iic0 iic shift register 0 i 2 c 572 iic1 iic shift register 1 i 2 c 572 iic2 iic shift register 2 i 2 c 572 iicc0 iic control register 0 i 2 c 558 iicc1 iic control register 1 i 2 c 558 iicc2 iic control register 2 i 2 c 558 iiccl0 iic clock select register 0 i 2 c 568 iiccl1 iic clock select register 1 i 2 c 568 iiccl2 iic clock select register 2 i 2 c 568 iicf0 iic flag register 0 i 2 c 566 iicf1 iic flag register 1 i 2 c 566 iicf2 iic flag register 2 i 2 c 566 iicic0 interrupt control register intc 668 iicic1 interrupt control register intc 667 iicic2 interrupt control register intc 668 iics0 iic status register 0 i 2 c 563 iics1 iic status register 1 i 2 c 563 iics2 iic status register 2 i 2 c 563 iicx0 iic function expansion register 0 i 2 c 569 iicx1 iic function expansion register 1 i 2 c 569 iicx2 iic function expansion register 2 i 2 c 569
appendix a register index preliminary user's manual u17714ej1v0ud 805 (5/12) symbol name unit page imr0 interrupt mask register 0 intc 668 imr0h interrupt mask register 0h intc 668 imr0l interrupt mask register 0l intc 668 imr1 interrupt mask register 1 intc 668 imr1h interrupt mask register 1h intc 668 imr1l interrupt mask register 1l intc 668 imr2 interrupt mask register 2 intc 668 imr2h interrupt mask register 2h intc 668 imr2l interrupt mask register 2l intc 668 imr3 interrupt mask register 3 intc 668 imr3h interrupt mask register 3h intc 668 imr3l interrupt mask register 3l intc 668 imr4 interrupt mask register 4 intc 668 imr4h interrupt mask register 4h intc 668 imr4l interrupt mask register 4l intc 668 intf0 external falling edge specification register 0 intc 680 intf3 external falling edge specification register 3 intc 681 intf8 external falling edge specification register 8 intc 682 intf9h external falling edge specification register 9h intc 683 intr0 external rising edge specification register 0 intc 680 intr3 external rising edge specification register 3 intc 681 intr8 external rising edge specification register 8 intc 682 intr9h external rising edge specification register 9h intc 683 ispr in-service priority register intc 670 kric interrupt control register intc 668 krm key return mode register kr 688 lockr lock register cg 223 lviic interrupt control register intc 667 lvim low-voltage detection register lvi 726 lvis low-voltage detection level select register lvi 727 nfc noise elimination control register intc 684 ocdm on-chip debug mode register debug 760 ocks0 iic division clock select register 0 i 2 c 572 ocks1 iic division clock select register 1 i 2 c 572 osts oscillation stabilization time select register wdt 693 p0 port 0 register port 96 p1 port 1 register port 99 p3 port 3 register port 101 p3h port 3 register h port 101 p3l port 3 register l port 101 p4 port 4 register port 106 p5 port 5 register port 108 p6 port 6 register port 113 p6h port 6 register h port 113 p6l port 6 register l port 113
appendix a register index preliminary user's manual u17714ej1v0ud 806 (6/12) symbol name unit page p7h port 7 register h port 117 p7l port 7 register l port 117 p8 port 8 register port 118 p9 port 9 register port 121 p9h port 9 register h port 121 p9l port 9 register l port 121 pc program counter cpu 48 pcc processor clock control register cg 215 pcd port cd register port 128 pcm port cm register port 129 pcs port cs register port 131 pct port ct register port 133 pdh port dh register port 135 pdl port dl register port 138 pdlh port dl register h port 138 pdll port dl register l port 138 pemu1 peripheral emulation register 1 cpu 731 pf0 port 0 function register port 98 pf3 port 3 function register port 105 pf3h port 3 function register h port 105 pf3l port 3 function register l port 105 pf4 port 4 function register port 107 pf5 port 5 function register port 111 pf6 port 6 function register port 115 pf6h port 6 function register h port 115 pf6l port 6 function register l port 115 pf8 port 8 function register port 119 pf9 port 9 function register port 127 pf9h port 9 function register h port 127 pf9l port 9 function register l port 127 pfc0 port 0 function control register port 98 pfc3 port 3 function control register port 103 pfc3h port 3 function control register h port 103 pfc3l port 3 function control register l port 103 pfc4 port 4 function control register port 107 pfc5 port 5 function control register port 109 pfc6h port 6 function control register h port 115 pfc9 port 9 function control register port 124 pfc9h port 9 function control register h port 124 pfc9l port 9 function control register l port 124 pfce3l port 3 function control expansion register l port 103 pfce5 port 5 function control expansion register port 110 pfce9 port 9 function control expansion register port 124 pfce9h port 9 function control expansion register h port 124 pfce9l port 9 function control expansion register l port 124
appendix a register index preliminary user's manual u17714ej1v0ud 807 (7/12) symbol name unit page pic0 interrupt control register intc 667 pic1 interrupt control register intc 667 pic2 interrupt control register intc 667 pic3 interrupt control register intc 667 pic4 interrupt control register intc 667 pic5 interrupt control register intc 667 pic6 interrupt control register intc 667 pic7 interrupt control register intc 667 pic8 interrupt control register intc 668 pllctl pll control register cg 221 plls pll lockup time specification register cg 224 pm0 port 0 mode register port 96 pm1 port 1 mode register port 99 pm3 port 3 mode register port 101 pm3h port 3 mode register h port 101 pm3l port 3 mode register l port 101 pm4 port 4 mode register port 106 pm5 port 5 mode register port 108 pm6 port 6 mode register port 113 pm6h port 6 mode register h port 113 pm6l port 6 mode register l port 113 pm7h port 7 mode register h port 117 pm7l port 7 mode register l port 117 pm8 port 8 mode register port 118 pm9 port 9 mode register port 121 pm9h port 9 mode register h port 121 pm9l port 9 mode register l port 121 pmc0 port 0 mode control register port 97 pmc3 port 3 mode control register port 102 pmc3h port 3 mode control register h port 102 pmc3l port 3 mode control register l port 102 pmc4 port 4 mode control register port 107 pmc5 port 5 mode control register port 109 pmc6 port 6 mode control register port 114 pmc6h port 6 mode control register h port 114 pmc6l port 6 mode control register l port 114 pmc8 port 8 mode control register port 119 pmc9 port 9 mode control register port 122 pmc9h port 9 mode control register h port 122 pmc9l port 9 mode control register l port 122 pmccm port cm mode control register port 130 pmccs port cs mode control register port 132 pmcct port ct mode control register port 134 pmcd port cd mode register port 128 pmcdh port dh mode control register port 136
appendix a register index preliminary user's manual u17714ej1v0ud 808 (8/12) symbol name unit page pmcdl port dl mode control register port 139 pmcdlh port dl mode control register h port 139 pmcdll port dl mode control register l port 139 pmcm port cm mode register port 129 pmcs port cs mode register port 131 pmct port ct mode register port 133 pmdh port dh mode register port 135 pmdl port dl mode register port 138 pmdlh port dl mode register h port 138 pmdll port dl mode register l port 138 prcmd command register cpu 84 prscm0 prescaler compare register 0 wt 425 prscm1 prescaler compare register 1 csi 548 prscm2 prescaler compare register 2 csi 548 prscm3 prescaler compare register 3 csi 548 prsm0 prescaler mode register 0 wt 424 prsm1 prescaler mode register 1 csi 547 prsm2 prescaler mode register 2 csi 547 prsm3 prescaler mode register 3 csi 547 psc power save control register cg 691 psmr power save mode register cg 692 psw program status word cpu 52 r0 to r31 general-purpose registers cpu 48 rams internal ram data status register cg 727 rcm internal oscillation mode register cg 219 resf reset source flag register reset 710 rtbh0 real-time output buffer register 0h rtp 438 rtbh1 real-time output buffer register 1h rtp 438 rtbl0 real-time output buffer register 0l rtp 438 rtbl1 real-time output buffer register 1l rtp 438 rtpc0 real-time output port control register 0 rtp 440 rtpc1 real-time output port control register 1 rtp 440 rtpm0 real-time output port mode register 0 rtp 439 rtpm1 real-time output port mode register 1 rtp 439 selcnt0 selector operation control register 0 timer 312 sva0 slave address register 0 i 2 c 573 sva1 slave address register 1 i 2 c 573 sva2 slave address register 2 i 2 c 573 sys system status register cpu 85 tm0cmp0 tmm0 compare register 0 timer 414 tm0ctl0 tmm0 control register 0 timer 415 tm0eqic0 interrupt control register intc 667 tp0ccic0 interrupt control register intc 667 tp0ccic1 interrupt control register intc 667 tp0ccr0 tmp0 capture/compare register 0 timer 235
appendix a register index preliminary user's manual u17714ej1v0ud 809 (9/12) symbol name unit page tp0ccr1 tmp0 capture/compare register 1 timer 237 tp0cnt tmp0 counter read buffer register timer 239 tp0ctl0 tmp0 control register 0 timer 229 tp0ctl1 tmp0 control register 1 timer 229 tp0ioc0 tmp0 i/o control register 0 timer 231 tp0ioc1 tmp0 i/o control register 1 timer 232 tp0ioc2 tmp0 i/o control register 2 timer 233 tp0opt0 tmp0 option register 0 timer 234 tp0ovic interrupt control register intc 667 tp1ccic0 interrupt control register intc 667 tp1ccic1 interrupt control register intc 667 tp1ccr0 tmp1 capture/compare register 0 timer 235 tp1ccr1 tmp1 capture/compare register 1 timer 237 tp1cnt tmp1 counter read buffer register timer 239 tp1ctl0 tmp1 control register 0 timer 229 tp1ctl1 tmp1 control register 1 timer 229 tp1ioc0 tmp1 i/o control register 0 timer 231 tp1ioc1 tmp1 i/o control register 1 timer 232 tp1ioc2 tmp1 i/o control register 2 timer 233 tp1opt0 tmp1 option register 0 timer 234 tp1ovic interrupt control register intc 667 tp2ccic0 interrupt control register intc 667 tp2ccic1 interrupt control register intc 667 tp2ccr0 tmp2 capture/compare register 0 timer 235 tp2ccr1 tmp2 capture/compare register 1 timer 237 tp2cnt tmp2 counter read buffer register timer 239 tp2ctl0 tmp2 control register 0 timer 229 tp2ctl1 tmp2 control register 1 timer 229 tp2ioc0 tmp2 i/o control register 0 timer 231 tp2ioc1 tmp2 i/o control register 1 timer 232 tp2ioc2 tmp2 i/o control register 2 timer 233 tp2opt0 tmp2 option register 0 timer 234 tp2ovic interrupt control register intc 667 tp3ccic0 interrupt control register intc 667 tp3ccic1 interrupt control register intc 667 tp3ccr0 tmp3 capture/compare register 0 timer 235 tp3ccr1 tmp3 capture/compare register 1 timer 237 tp3cnt tmp3 counter read buffer register timer 239 tp3ctl0 tmp3 control register 0 timer 229 tp3ctl1 tmp3 control register 1 timer 229 tp3ioc0 tmp3 i/o control register 0 timer 231 tp3ioc1 tmp3 i/o control register 1 timer 232 tp3ioc2 tmp3 i/o control register 2 timer 233 tp3opt0 tmp3 option register 0 timer 234 tp3ovic interrupt control register intc 667
appendix a register index preliminary user's manual u17714ej1v0ud 810 (10/12) symbol name unit page tp4ccic0 interrupt control register intc 667 tp4ccic1 interrupt control register intc 667 tp4ccr0 tmp4 capture/compare register 0 timer 235 tp4ccr1 tmp4 capture/compare register 1 timer 237 tp4cnt tmp4 counter read buffer register timer 239 tp4ctl0 tmp4 control register 0 timer 229 tp4ctl1 tmp4 control register 1 timer 229 tp4ioc0 tmp4 i/o control register 0 timer 231 tp4ioc1 tmp4 i/o control register 1 timer 232 tp4ioc2 tmp4 i/o control register 2 timer 233 tp4opt0 tmp4 option register 0 timer 234 tp4ovic interrupt control register intc 667 tp5ccic0 interrupt control register intc 667 tp5ccic1 interrupt control register intc 667 tp5ccr0 tmp5 capture/compare register 0 timer 235 tp5ccr1 tmp5 capture/compare register 1 timer 237 tp5cnt tmp5 counter read buffer register timer 239 tp5ctl0 tmp5 control register 0 timer 229 tp5ctl1 tmp5 control register 1 timer 229 tp5ioc0 tmp5 i/o control register 0 timer 231 tp5ioc1 tmp5 i/o control register 1 timer 232 tp5ioc2 tmp5 i/o control register 2 timer 233 tp5opt0 tmp5 option register 0 timer 234 tp5ovic interrupt control register intc 667 tp6ccic0 interrupt control register intc 668 tp6ccic1 interrupt control register intc 668 tp6ccr0 tmp6 capture/compare register 0 timer 235 tp6ccr1 tmp6 capture/compare register 1 timer 237 tp6cnt tmp6 counter read buffer register timer 239 tp6ctl0 tmp6 control register 0 timer 229 tp6ctl1 tmp6 control register 1 timer 229 tp6ioc0 tmp6 i/o control register 0 timer 231 tp6ioc1 tmp6 i/o control register 1 timer 232 tp6ioc2 tmp6 i/o control register 2 timer 233 tp6opt0 tmp6 option register 0 timer 234 tp6ovic interrupt control register intc 668 tp7ccic0 interrupt control register intc 668 tp7ccic1 interrupt control register intc 668 tp7ccr0 tmp7 capture/compare register 0 timer 235 tp7ccr1 tmp7 capture/compare register 1 timer 237 tp7cnt tmp7 counter read buffer register timer 239 tp7ctl0 tmp7 control register 0 timer 229 tp7ctl1 tmp7 control register 1 timer 229 tp7ioc0 tmp7 i/o control register 0 timer 231 tp7ioc1 tmp7 i/o control register 1 timer 232
appendix a register index preliminary user's manual u17714ej1v0ud 811 (11/12) symbol name unit page tp7ioc2 tmp7 i/o control register 2 timer 233 tp7opt0 tmp7 option register 0 timer 234 tp7ovic interrupt control register intc 668 tp8ccic0 interrupt control register intc 668 tp8ccic1 interrupt control register intc 668 tp8ccr0 tmp8 capture/compare register 0 timer 235 tp8ccr1 tmp8 capture/compare register 1 timer 237 tp8cnt tmp8 counter read buffer register timer 239 tp8ctl0 tmp8 control register 0 timer 229 tp8ctl1 tmp8 control register 1 timer 229 tp8ioc0 tmp8 i/o control register 0 timer 231 tp8ioc1 tmp8 i/o control register 1 timer 232 tp8ioc2 tmp8 i/o control register 2 timer 233 tp8opt0 tmp8 option register 0 timer 234 tp8ovic interrupt control register intc 668 tq0ccic0 interrupt control register intc 667 tq0ccic1 interrupt control register intc 667 tq0ccic2 interrupt control register intc 667 tq0ccic3 interrupt control register intc 667 tq0ccr0 tmq0 capture/compare register 0 timer 324 tq0ccr1 tmq0 capture/compare register 1 timer 326 tq0ccr2 tmq0 capture/compare register 2 timer 328 tq0ccr3 tmq0 capture/compare register 3 timer 330 tq0cnt tmq0 counter read buffer register timer 332 tq0ctl0 tmq0 control register 0 timer 318 tq0ctl1 tmq0 control register 1 timer 319 tq0ioc0 tmq0 i/o control register 0 timer 320 tq0ioc1 tmq0 i/o control register 1 timer 321 tq0ioc2 tmq0 i/o control register 2 timer 322 tq0opt0 tmq0 option register 0 timer 323 tq0ovic interrupt control register intc 667 ua0ctl0 uarta0 control register 0 uart 490 ua0ctl1 uarta0 control register 1 uart 512 ua0ctl2 uarta0 control register 2 uart 513 ua0opt0 uarta0 option control register 0 uart 492 ua0ric interrupt control register intc 668 ua0rx uarta0 receive data register uart 495 ua0str uarta0 status register uart 493 ua0tic interrupt control register intc 668 ua0tx uarta0 transmit data register uart 495 ua1ctl0 uarta1 control register 0 uart 490 ua1ctl1 uarta1 control register 1 uart 512 ua1ctl2 uarta1 control register 2 uart 513 ua1opt0 uarta1 option control register 0 uart 492 ua1ric interrupt control register intc 668
appendix a register index preliminary user's manual u17714ej1v0ud 812 (12/12) symbol name unit page ua1rx uarta1 receive data register uart 495 ua1str uarta1 status register uart 493 ua1tic interrupt control register intc 668 ua1tx uarta1 transmit data register uart 495 ua2ctl0 uarta2 control register 0 uart 490 ua2ctl1 uarta2 control register 1 uart 512 ua2ctl2 uarta2 control register 2 uart 513 ua2opt0 uarta2 option control register 0 uart 492 ua2ric interrupt control register intc 668 ua2rx uarta2 receive data register uart 495 ua2str uarta2 status register uart 493 ua2tic interrupt control register intc 668 ua2tx uarta2 transmit data register uart 495 ua3ctl0 uarta3 control register 0 uart 490 ua3ctl1 uarta3 control register 1 uart 512 ua3ctl2 uarta3 control register 2 uart 513 ua3opt0 uarta3 option control register 0 uart 492 ua3ric interrupt control register intc 668 ua3rx uarta3 receive data register uart 495 ua3str uarta3 status register uart 493 ua3tic interrupt control register intc 668 ua3tx uarta3 transmit data register uart 495 vswc system wait control register cpu 86 wdte watchdog timer enable register wdt 434 wdtm2 watchdog timer mode register 2 wdt 433 wtic interrupt control register intc 668 wtiic interrupt control register intc 668 wtm watch timer operation mode register wt 426
preliminary user's manual u17714ej1v0ud 813 appendix b instruction set list b.1 conventions (1) register symbols u sed to describe operands register symbol explanation reg1 general-purpose registers: used as source registers. reg2 general-purpose registers: used mainly as destination registers. also used as source register in some instructions. reg3 general-purpose registers: used mainly to store the remainders of division resu lts and the higher 32 bits of multiplication results. bit#3 3-bit data for specifying the bit number immx x bit immediate data dispx x bit displacement data regid system register number vector 5-bit data that specifies the trap vector (00h to 1fh) cccc 4-bit data that shows the conditions code sp stack pointer (r3) ep element pointer (r30) listx x item register list (2) register symbols used to describe opcodes register symbol explanation r 1-bit data of a code that specifies reg1 or regid r 1-bit data of the code that specifies reg2 w 1-bit data of the code that specifies reg3 d 1-bit displacement data i 1-bit immediate data (indicates th e higher bits of immediate data) i 1-bit immediate data cccc 4-bit data that shows the condition codes cccc 4-bit data that shows the condition codes of bcond instruction bbb 3-bit data for specifying the bit number l 1-bit data that specifies a program register in the register list
appendix b instruction set list preliminary user's manual u17714ej1v0ud 814 (3) register symbols used in operations register symbol explanation input for gr [ ] general-purpose register sr [ ] system register zero-extend (n) expand n with zeros until word length. sign-extend (n) expand n with signs until word length. load-memory (a, b) read size b data from address a. store-memory (a, b, c) write data b into address a in size c. load-memory-bit (a, b) read bit b of address a. store-memory-bit (a, b, c) write c to bit b of address a. saturated (n) execute saturated processing of n (n is a 2's complement). if, as a result of calculations, n 7fffffffh, let it be 7fffffffh. n 80000000h, let it be 80000000h. result reflects the results in a flag. byte byte (8 bits) halfword half word (16 bits) word word (32 bits) + addition ? subtraction ll bit concatenation multiplication division % remainder from division results and logical product or logical sum xor exclusive or not logical negation logically shift left by logical shift left logically shift right by logical shift right arithmetically shift right by arithmetic shift right (4) register symbols u sed in execution clock register symbol explanation i if executing another instruction immediately a fter executing the first instruction (issue). r if repeating execution of the same instruction immedi ately after executing the first instruction (repeat). l if using the results of instruction execution in the instruction immediately afte r the execution (latency).
appendix b instruction set list preliminary user's manual u17714ej1v0ud 815 (5) register symbols used in flag operations identifier explanation (blank) no change 0 clear to 0 x set or cleared in accordance with the results. r previously saved values are restored. (6) condition codes condition code (cccc) condition formula explanation 0 0 0 0 ov = 1 overflow 1 0 0 0 ov = 0 no overflow 0 0 0 1 cy = 1 carry lower (less than) 1 0 0 1 cy = 0 no carry not lower (greater than or equal) 0 0 1 0 z = 1 zero 1 0 1 0 z = 0 not zero 0 0 1 1 (cy or z) = 1 not higher (less than or equal) 1 0 1 1 (cy or z) = 0 higher (greater than) 0 1 0 0 s = 1 negative 1 1 0 0 s = 0 positive 0 1 0 1 ? always (unconditional) 1 1 0 1 sat = 1 saturated 0 1 1 0 (s xor ov) = 1 less than signed 1 1 1 0 (s xor ov) = 0 greater than or equal signed 0 1 1 1 ((s xor ov) or z) = 1 less than or equal signed 1 1 1 1 ((s xor ov) or z) = 0 greater than signed
appendix b instruction set list preliminary user's manual u17714ej1v0ud 816 b.2 instruction set (in alphabetical order) (1/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat reg1,reg2 r r rr r0 01 11 0 rrrrr gr[reg2] gr[reg2]+gr[reg1] 1 1 1 add imm5,reg2 rrrrr010010iiiii gr[reg2] gr[reg2]+sign-extend(imm5) 1 1 1 addi imm16,reg1,reg2 r r rr r1 10 00 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 and reg1,reg2 r r rr r0 01 01 0 rrrrr gr[reg2] gr[reg2]and gr[reg1] 1 1 1 0 andi imm16,reg1,reg2 r r rr r1 10 11 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]and zero-extend(imm16) 1 1 1 0 when conditions are satisfied 2 note 2 2 note 2 2 note 2 bcond disp9 ddddd1011dddcccc note 1 if conditions are satisfied then pc pc+sign-extend(disp9) when conditions are not satisfied 1 1 1 bsh reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000010 gr[reg3] gr[reg2] (23 : 16) ll gr[reg2] (31 : 24) ll gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) 1 1 1 0 bsw reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000000 gr[reg3] gr[reg2] (7 : 0) ll gr[reg2] (15 : 8) ll gr [reg2] (23 : 16) ll gr[reg2] (31 : 24) 1 1 1 0 callt imm6 0000001000iiiiii ctpc pc+2(return pc) ctpsw psw adr ctbp+zero-extend(imm6 logically shift left by 1) pc ctbp+zero-extend(load-memory(adr,halfword)) 4 4 4 bit#3,disp16[reg1] 10bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,0) 3 note 3 3 note 3 3 note 3 clr1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100100 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,0) 3 note 3 3 note 3 3 note 3 cccc,imm5,reg2,reg3 rrrrr111111iiiii wwwww011000cccc0 if conditions are satisfied then gr[reg3] sign-extended(imm5) else gr[reg3] gr[reg2] 1 1 1 cmov cccc,reg1,reg2,reg3 r r r r r 1 1 1 1 1 1 r r r r wwwww011001cccc0 if conditions are satisfied then gr[reg3] gr[reg1] else gr[reg3] gr[reg2] 1 1 1 reg1,reg2 r r rr r0 01 11 1 rrrrr result gr[reg2]?gr[reg1] 1 1 1 cmp imm5,reg2 rrrrr010011iiiii result gr[reg2]?sign-extend(imm5) 1 1 1 ctret 0000011111100000 0000000101000100 pc ctpc psw ctpsw 3 3 3 r r r r r dbret 0000011111100000 0000000101000110 pc dbpc psw dbpsw 3 3 3 r r r r r
appendix b instruction set list preliminary user's manual u17714ej1v0ud 817 (2/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat dbtrap 1111100001000000 dbpc pc+2 (restored pc) dbpsw psw psw.np 1 psw.ep 1 psw.id 1 pc 00000060h 3 3 3 di 0000011111100000 0000000101100000 psw.id 1 1 1 1 imm5,list12 0000011001iiiiil lllllllllll00000 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded n+1 note 4 n+1 note 4 n+1 note 4 dispose imm5,list12,[reg1] 0 0 0 0 0 1 1 0 0 1 i i i i i l lllllllllllrrrrr note 5 sp sp+zero-extend(imm5 logically shift left by 2) gr[reg in list12] load-memory(sp,word) sp sp+4 repeat 2 steps above until all regs in list12 is loaded pc gr[reg1] n+3 note 4 n+3 note 4 n+3 note 4 div reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01011000000 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 35 35 35 reg1,reg2 r r rr r0 00 01 0 rrrrr gr[reg2] gr[reg2]gr[reg1] note 6 35 35 35 divh reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01010000000 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 35 35 35 divhu reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01010000010 gr[reg2] gr[reg2]gr[reg1] note 6 gr[reg3] gr[reg2]%gr[reg1] 34 34 34 divu reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01011000010 gr[reg2] gr[reg2]gr[reg1] gr[reg3] gr[reg2]%gr[reg1] 34 34 34 ei 1000011111100000 0000000101100000 psw.id 0 1 1 1 halt 0000011111100000 0000000100100000 stop 1 1 1 hsw reg2,reg3 r r r r r 1 1 1 1 1 1 0 0 0 0 0 wwwww01101000100 gr[reg3] gr[reg2](15 : 0) ll gr[reg2] (31 : 16) 1 1 1 0 jarl disp22,reg2 r r r r r 1 1 1 1 0 d d d d d d ddddddddddddddd0 note 7 gr[reg2] pc+4 pc pc+sign-extend(disp22) 2 2 2 jmp [reg1] 00000000011rrrrr pc gr[reg1] 3 3 3 jr disp22 0000011110dddddd ddddddddddddddd0 note 7 pc pc+sign-extend(disp22) 2 2 2 ld.b disp16[reg1],reg2 r r rr r1 11 00 0 rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,byte)) 1 1 note 11 ld.bu disp16[reg1],reg2 r r rr r1 11 10 b rrrrr dddddddddddddd1 notes 8, 10 adr gr[reg1]+sign-extend(disp16) gr[reg2] zero-extend(load-memory(adr,byte)) 1 1 note 11
appendix b instruction set list preliminary user's manual u17714ej1v0ud 818 (3/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat ld.h disp16[reg1],reg2 rrrrr111001rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] sign-extend(load-memory(adr,halfword)) 1 1 note 11 other than regid = psw 1 1 1 ldsr reg2,regid rrrrr111111rrrrr 0000000000100000 note 12 sr[regid] gr[reg2] regid = psw 1 1 1 ld.hu disp16[reg1],reg2 r r rr r1 11 11 1 rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] zero-extend(load-memory(adr,halfword) 1 1 note 11 ld.w disp16[reg1],reg2 r r rr r1 11 00 1 rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) gr[reg2] load-memory(adr,word) 1 1 note 11 reg1,reg2 r r rr r0 00 00 0 rrrrr gr[reg2] gr[reg1] 1 1 1 imm5,reg2 rrrrr010000iiiii gr[reg2] sign-extend(imm5) 1 1 1 mov imm32,reg1 00000110001rrrrr iiiiiiiiiiiiiiii iiiiiiiiiiiiiiii gr[reg1] imm32 2 2 2 movea imm16,reg1,reg2 r r rr r1 10 00 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+sign-extend(imm16) 1 1 1 movhi imm16,reg1,reg2 r r rr r1 10 01 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]+(imm16 ll 0 16 ) 1 1 1 reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01000100000 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] note 14 1 4 5 mul imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii00 note 13 gr[reg3] ll gr[reg2] gr[reg2]xsign-extend(imm9) 1 4 5 reg1,reg2 r r rr r0 00 11 1 rrrrr gr[reg2] gr[reg2] note 6 xgr[reg1] note 6 1 1 2 mulh imm5,reg2 rrrrr010111iiiii gr[reg2] gr[reg2] note 6 xsign-extend(imm5) 1 1 2 mulhi imm16,reg1,reg2 r r rr r1 10 11 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] note 6 ximm16 1 1 2 reg1,reg2,reg3 r r rr r1 11 11 1 rrrrr wwwww01000100010 gr[reg3] ll gr[reg2] gr[reg2]xgr[reg1] note 14 1 4 5 mulu imm9,reg2,reg3 rrrrr111111iiiii wwwww01001iiii10 note 13 gr[reg3] ll gr[reg2] gr[reg2]xzero-extend(imm9) 1 4 5 nop 0000000000000000 pass at least one clock cycle doing nothing. 1 1 1 not reg1,reg2 r r rr r0 00 00 1 rrrrr gr[reg2] not(gr[reg1]) 1 1 1 0 bit#3,disp16[reg1] 01bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not(load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,z flag) 3 note 3 3 note 3 3 note 3 not1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100010 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,z flag) 3 note 3 3 note 3 3 note 3
appendix b instruction set list preliminary user's manual u17714ej1v0ud 819 (4/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat or reg1,reg2 r r rr r0 01 00 0 rrrrr gr[reg2] gr[reg2]or gr[reg1] 1 1 1 0 ori imm16,reg1,reg2 r r rr r1 10 10 0 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1]or zero-extend(imm16) 1 1 1 0 list12,imm5 0000011110iiiiil lllllllllll00001 store-memory(sp?4,gr[reg in list12],word) sp sp?4 repeat 1 step above until all regs in list12 is stored sp sp-zero-extend(imm5) n+1 note 4 n+1 note 4 n+1 note 4 prepare list12,imm5, sp/imm note 15 0000011110iiiiil lllllllllllff011 imm16/imm32 note 16 store-memory(sp?4,gr[reg in list12],word) sp sp+4 repeat 1 step above until all regs in list12 is stored sp sp-zero-extend (imm5) ep sp/imm n+2 note 4 note 17 n+2 note 4 note 17 n+2 note 4 note 17 reti 0000011111100000 0000000101000000 if psw.ep=1 then pc eipc psw eipsw else if psw.np=1 then pc fepc psw fepsw else pc eipc psw eipsw 3 3 3 r r r r r reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000010100000 gr[reg2] gr[reg2]arithmetically shift right by gr[reg1] 1 1 1 0 sar imm5,reg2 rrrrr010101iiiii gr[reg2] gr[reg2]arithmetically shift right by zero-extend (imm5) 1 1 1 0 sasf cccc,reg2 rrrrr1111110cccc 0000001000000000 if conditions are satisfied then gr[reg2] (gr[reg2]logically shift left by 1) or 00000001h else gr[reg2] (gr[reg2]logically shift left by 1) or 00000000h 1 1 1 reg1,reg2 r r rr r0 00 11 0 rrrrr gr[reg2] saturated(gr[reg2]+gr[reg1]) 1 1 1 satadd imm5,reg2 rrrrr010001iiiii gr[reg2] saturated(gr[reg2]+sign-extend(imm5) 1 1 1 satsub reg1,reg2 r r rr r0 00 10 1 rrrrr gr[reg2] saturated(gr[reg2]?gr[reg1]) 1 1 1 satsubi imm16,reg1,reg2 r r rr r1 10 01 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] saturated(gr[reg1]?sign-extend(imm16) 1 1 1 satsubr reg1,reg2 r r rr r0 00 10 0 rrrrr gr[reg2] saturated(gr[reg1]?gr[reg2]) 1 1 1 setf cccc,reg2 rrrrr1111110cccc 0000000000000000 if conditions are satisfied then gr[reg2] 00000001h else gr[reg2] 00000000h 1 1 1
appendix b instruction set list preliminary user's manual u17714ej1v0ud 820 (5/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat bit#3,disp16[reg1] 00bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit(adr,bit#3)) store-memory-bit(adr,bit#3,1) 3 note 3 3 note 3 3 note 3 set1 reg2,[reg1] r r rr r1 11 11 1 rrrrr 0000000011100000 adr gr[reg1] z flag not(load-memory-bit(adr,reg2)) store-memory-bit(adr,reg2,1) 3 note 3 3 note 3 3 note 3 reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000011000000 gr[reg2] gr[reg2] logically shift left by gr[reg1] 1 1 1 0 shl imm5,reg2 rrrrr010110iiiii gr[reg2] gr[reg2] logically shift left by zero-extend(imm5) 1 1 1 0 reg1,reg2 r r rr r1 11 11 1 rrrrr 0000000010000000 gr[reg2] gr[reg2] logically shift right by gr[reg1] 1 1 1 0 shr imm5,reg2 rrrrr010100iiiii gr[reg2] gr[reg2] logically shift right by zero-extend(imm5) 1 1 1 0 sld.b disp7[ep],reg2 r r r r r 0 1 1 0 d d d d d d d adr ep+zero-extend(disp7) gr[reg2] sign-extend(load-memory(adr,byte)) 1 1 note 9 sld.bu disp4[ep],reg2 rrrrr0000110dddd note 18 adr ep+zero-extend(disp4) gr[reg2] zero-extend(load-memory(adr,byte)) 1 1 note 9 sld.h disp8[ep],reg2 r r r r r 1 0 0 0 d d d d d d d note 19 adr ep+zero-extend(disp8) gr[reg2] sign-extend(load-memory(adr,halfword)) 1 1 note 9 sld.hu disp5[ep],reg2 rrrrr0000111dddd notes 18, 20 adr ep+zero-extend(disp5) gr[reg2] zero-extend(load-memory(adr,halfword)) 1 1 note 9 sld.w disp8[ep],reg2 rrrrr1010dddddd0 note 21 adr ep+zero-extend(disp8) gr[reg2] load-memory(adr,word) 1 1 note 9 sst.b reg2,disp7[ep] r r r r r 0 1 1 1 d d d d d d d adr ep+zero-extend(disp7) store-memory(adr,gr[reg2],byte) 1 1 1 sst.h reg2,disp8[ep] r r r r r 1 0 0 1 d d d d d d d note 19 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],halfword) 1 1 1 sst.w reg2,disp8[ep] rrrrr1010dddddd1 note 21 adr ep+zero-extend(disp8) store-memory(adr,gr[reg2],word) 1 1 1 st.b reg2,disp16[reg1] r r rr r1 11 01 0 rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) store-memory(adr,gr[reg2],byte) 1 1 1 st.h reg2,disp16[reg1] r r rr r1 11 01 1 rrrrr ddddddddddddddd0 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], halfword) 1 1 1 st.w reg2,disp16[reg1] rrrrr111011rrrrr ddddddddddddddd1 note 8 adr gr[reg1]+sign-extend(disp16) store-memory (adr,gr[reg2], word) 1 1 1 stsr regid,reg2 r r rr r1 11 11 1 rrrrr 0000000001000000 gr[reg2] sr[regid] 1 1 1
appendix b instruction set list preliminary user's manual u17714ej1v0ud 821 (6/6) execution clock flags mnemonic operand opcode operation i r l cy ov s z sat sub reg1,reg2 r r rr r0 01 10 1 rrrrr gr[reg2] gr[reg2]?gr[reg1] 1 1 1 subr reg1,reg2 r r rr r0 01 10 0 rrrrr gr[reg2] gr[reg1]?gr[reg2] 1 1 1 switch reg1 00000000010rrrrr adr (pc+2) + (gr [reg1] logically shift left by 1) pc (pc+2) + (sign-extend (load-memory (adr,halfword)) logically shift left by 1 5 5 5 sxb reg1 00000000101rrrrr gr[reg1] sign-extend (gr[reg1] (7 : 0)) 1 1 1 sxh reg1 00000000111rrrrr gr[reg1] sign-extend (gr[reg1] (15 : 0)) 1 1 1 trap vector 00000111111iiiii 0000000100000000 eipc pc+4 (restored pc) eipsw psw ecr.eicc interrupt code psw.ep 1 psw.id 1 pc 00000040h (when vector is 00h to 0fh) 00000050h (when vector is 10h to 1fh) 3 3 3 tst reg1,reg2 r r rr r0 01 01 1 rrrrr result gr[reg2] and gr[reg1] 1 1 1 0 bit#3,disp16[reg1] 11bbb111110rrrrr dddddddddddddddd adr gr[reg1]+sign-extend(disp16) z flag not (load-memory-bit (adr,bit#3)) 3 note 3 3 note 3 3 note 3 tst1 reg2, [reg1] r r rr r1 11 11 1 rrrrr 0000000011100110 adr gr[reg1] z flag not (load-memory-bit (adr,reg2)) 3 note 3 3 note 3 3 note 3 xor reg1,reg2 r r rr r0 01 00 1 rrrrr gr[reg2] gr[reg2] xor gr[reg1] 1 1 1 0 xori imm16,reg1,reg2 r r rr r1 10 10 1 rrrrr iiiiiiiiiiiiiiii gr[reg2] gr[reg1] xor zero-extend (imm16) 1 1 1 0 zxb reg1 00000000100rrrrr gr[reg1] zero-extend (gr[reg1] (7 : 0)) 1 1 1 zxh reg1 00000000110rrrrr gr[reg1] zero-extend (gr[reg1] (15 : 0)) 1 1 1 notes 1. dddddddd: higher 8 bits of disp9. 2. 3 if there is an instruction that rewrites the contents of the psw immediately before. 3. if there is no wait state (3 + the number of read access wait states). 4. n is the total number of list12 load registers. (a ccording to the number of wait states. also, if there are no wait states, n is the total number of list12 registers. if n = 0, same operation as when n = 1) 5. rrrrr: other than 00000. 6. the lower halfword data only are valid. 7. ddddddddddddddddddddd: the higher 21 bits of disp22. 8. ddddddddddddddd: the higher 15 bits of disp16. 9. according to the number of wait stat es (1 if there are no wait states). 10. b: bit 0 of disp16. 11. according to the number of wait stat es (2 if there are no wait states).
appendix b instruction set list preliminary user's manual u17714ej1v0ud 822 notes 12. in this instruction, for convenience of mnemonic descr iption, the source register is made reg2, but the reg1 field is used in the opcode. therefore, the m eaning of register specific ation in the mnemonic description and in the opcode differs from other instructions. rrrrr = regid specification rrrrr = reg2 specification 13. iiiii: lower 5 bits of imm9. iiii: higher 4 bits of imm9. 14. do not specify the same register fo r general-purpose registers reg1 and reg3. 15. sp/imm: specified by bits 19 and 20 of the sub-opcode. 16. ff = 00: load sp in ep. 01: load sign expanded 16-bit immediate data (bits 47 to 32) in ep. 10: load 16-bit logically left shifted 16-bit immediate data (bits 47 to 32) in ep. 11: load 32-bit immediate data (bits 63 to 32) in ep. 17. if imm = imm32, n + 3 clocks. 18. rrrrr: other than 00 000. 19. ddddddd: higher 7 bits of disp8. 20. dddd: higher 4 bits of disp5. 21. dddddd: higher 6 bits of disp8.


▲Up To Search▲   

 
Price & Availability of UPD70F3724

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X